Skip to content

Instantly share code, notes, and snippets.

@sharifulislam52
Last active June 24, 2018 17:12
Show Gist options
  • Select an option

  • Save sharifulislam52/1cca507e66296459ae3fec6a4ecd352d to your computer and use it in GitHub Desktop.

Select an option

Save sharifulislam52/1cca507e66296459ae3fec6a4ecd352d to your computer and use it in GitHub Desktop.
// system current second
public int the_current_second(){
int the_second = new Time(System.currentTimeMillis()).getSeconds();
return the_second;
}
// return current day of week
public String current_day(){
Date date = new Date();
CharSequence this_day = DateFormat.format("EEEE", date.getTime()); // gives like (Wednesday)
return this_day.toString();
}
// current date
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
public String get_current_date(){
Date current_date = Calendar.getInstance().getTime();
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String formattedDate = df.format(current_date);
return formattedDate;
}
// open keybord
public void opern_keybord(){
InputMethodManager imm = (InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
// cose keybord
public void close_keybord(){
InputMethodManager imm = (InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment