diff --git a/app/src/main/java/org/cagnulein/android_remote/MainActivity.java b/app/src/main/java/org/cagnulein/android_remote/MainActivity.java index 830a138..fdc452e 100644 --- a/app/src/main/java/org/cagnulein/android_remote/MainActivity.java +++ b/app/src/main/java/org/cagnulein/android_remote/MainActivity.java @@ -590,7 +590,8 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { private boolean handleKeyEvent(int keyCode, KeyEvent event) { Log.d("keyboard", event.toString()); // Se non hai gestito l'evento, passa al gestore predefinito - scrcpy.sendKeyevent(keyCode); + if(scrcpy != null) + scrcpy.sendKeyevent(keyCode); return super.onKeyDown(keyCode, event); } @@ -625,6 +626,10 @@ private void licenseReply(String response) { private void licenseRequest() { runOnUiThread(() -> { final EditText editText_patreon = findViewById(R.id.editText_patreon); + if(editText_patreon == null) { + handler.postDelayed(licenseRunnable, 30000); // 30 seconds delay + return; + } String userEmail = editText_patreon.getText().toString(); if(userEmail.length() == 0) { handler.postDelayed(licenseRunnable, 30000); // 30 seconds delay