Fix NPE in MainActivity.onDialogCompleted by guarding showSoftInput call with null focus check

This commit is contained in:
mschiller890
2026-03-11 19:10:08 +02:00
parent 8875342557
commit a80d2ee847

View File

@@ -468,17 +468,16 @@ public class MainActivity extends NativeActivity {
_userInputStatus = 1; _userInputStatus = 1;
InputMethodManager inputManager = (InputMethodManager)getSystemService("input_method"); InputMethodManager inputManager = (InputMethodManager)getSystemService("input_method");
boolean result = inputManager.showSoftInput(this.getCurrentFocus(), InputMethodManager.SHOW_IMPLICIT); View focused = this.getCurrentFocus();
} if (focused != null) {
boolean result = inputManager.showSoftInput(focused, InputMethodManager.SHOW_IMPLICIT);
protected void onStart() { } else {
//System.out.println("onStart"); // fallback: try to show using decor view token
super.onStart(); View decor = getWindow().getDecorView();
} if (decor != null) {
inputManager.showSoftInput(decor, InputMethodManager.SHOW_IMPLICIT);
protected void onResume() { }
//System.out.println("onResume"); }
super.onResume();
} }
protected void onPause() { protected void onPause() {