Reputation: 657
I use android:windowSoftInputMode="stateVisible|adjustPan"
in my manifest file to open the softkeyboard when the main activity is launched.
This works great, apart from when i come back to the main activity from another using the back button; The softkeyboard does not reappear.
How do i make the softkeyboard appear when coming back to the main activity?
Thanks for any help in advance.
Upvotes: 0
Views: 188
Reputation: 10622
On back button it just remove the current activity from the stack and show the previous activity that is why softkeyboard is not getting opened . you can override the onKeyDown() method and on back button you can call your activity again.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
// start your activity again here
Log.d(this.getClass().getName(), "back button pressed");
}
return super.onKeyDown(keyCode, event);
}
Upvotes: 2