I need to display the virtual keyboard when the application starts, but so far I've failed.
I use this code in method "OnCreate"to display the virtual keyboard
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(txtBuscar.getId(), InputMethodManager.SHOW_FORCED);
this code works fine on any screen at any time, but does not work when the "first" activity begins. Why?
I tried it when I start another activity and it works, but does not work when I start the "first"activity.
I tried to put this code in the events "OnCreate"and many more .... but it seems not work.
is there anyway to "force" to display the keyboard when I start the application?
Thanks in advance.
I Found the solution:
txtPassword.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager keyboard = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(txtPassword, 0);
}
},200);
Thanks !!!