I'm currently using Oppo F7 to test my app that I made using Android Studio. However, when I tested it and I clicked on a textbox (or EditText), the keyboard doesn't show/pop-up. Helpppp..
Note:
- My Oppo F7 is running on Android 8.1.0 (API 27)
- It works on the emulator on my laptop but it's far to laggy for me to test
use like this
public static void showSoftKeyboard(final Context context, final EditText editText) {
try {
editText.requestFocus();
editText.postDelayed(
new Runnable() {
@Override
public void run() {
InputMethodManager keyboard = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(editText, 0);
}
}
, 200);
} catch (NullPointerException npe) {
npe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
in your activity call on text click
showSoftKeyboard(this, yourEditTextToFocus);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.