]> git.ktnx.net Git - mobile-ledger.git/commitdiff
Misc.showSoftKeyboard: handle fragemtn.getActivity() returning null
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 25 Nov 2019 22:07:24 +0000 (00:07 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 25 Nov 2019 22:07:36 +0000 (00:07 +0200)
app/src/main/java/net/ktnx/mobileledger/utils/Misc.java

index bbfa828baa449467bbfe53b71cf05badc97aa93d..b28900f9320850e7a0ccb88d6a80aa8f8e2f271a 100644 (file)
@@ -22,6 +22,7 @@ import android.content.res.Configuration;
 import android.view.WindowManager;
 
 import androidx.fragment.app.Fragment;
 import android.view.WindowManager;
 
 import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
 
 public class Misc {
     public static boolean isZero(float f) {
 
 public class Misc {
     public static boolean isZero(float f) {
@@ -37,6 +38,8 @@ public class Misc {
                     .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
     }
     public static void showSoftKeyboard(Fragment fragment) {
                     .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
     }
     public static void showSoftKeyboard(Fragment fragment) {
-        showSoftKeyboard(fragment.getActivity());
+        final FragmentActivity activity = fragment.getActivity();
+        if (activity != null)
+            showSoftKeyboard(activity);
     }
 }
     }
 }