Please explain me the issue about soft keyboard. For example, I have an EditText on my activity or dialogfragment or fragmentactivity, whatever. here it is:
for me by adding this line android:windowSoftInputMode="stateVisible" in your manifest like this
**<activity
android:name=".mmmmm.zzzzzzz.yyyyyy.xxxxxx"
android:windowSoftInputMode="stateVisible"
android:label="@string/title_activity_print_recharge"></activity>**
this is how I solved it
This is what worked for me -
Create your own EditText class and override following method -
public class FocussableEditText extends EditText {
public FocussableEditText(Context context) {
super(context);
}
public FocussableEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FocussableEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (hasWindowFocus) {
InputMethodManager imm = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
}
}
}
http://debuggingisfun.blogspot.in/2014/08/android-show-soft-keyboard.html
Try this
@Override
public void onResume() {
super.onResume();
final View v = getDialog().findViewById(R.id.edit_text_id);
v.post(new Runnable() {
@Override
public void run() {
v.requestFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
}
});
}