I have 2 activities, A and B. When A starts, it checks for a condition and if true, it calls startActivityForResult()
to start B. B only takes text input so it
If requestFocus on an EditText isn't showing it, maybe this'll do it:
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditText, 0);
Look here for more information.
Major Attention Required!
android:windowSoftInputMode="stateVisible|adjustPan"
This alone won't work to show keyboard on activity start.
You also need to explicitly add this into your class
editTextXYZ.requestFocus()
val imm: InputMethodManager =
getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(editTextXYZ, InputMethodManager.SHOW_IMPLICIT)
File : AndroidManifest.xml
<activity android:name=".MainActivity">
Add following property :
android:windowSoftInputMode="stateVisible"
Which worked for me.
If you're using an emulator, you have to turn the hard keyboard off in order for the soft keyboard to show.
What worked best for me is in Android Manifest for activity B adding
android:windowSoftInputMode="stateVisible"
Hope that helps for you as well.
Easiest solution: Put
android:windowSoftInputMode = "stateVisible"
in Activity section of AndroidManifest.xml