From: Damyan Ivanov Date: Mon, 25 Nov 2019 22:07:24 +0000 (+0200) Subject: Misc.showSoftKeyboard: handle fragemtn.getActivity() returning null X-Git-Tag: v0.11.0~25 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=24d0e498c1fd5278f28912efa5027c73fdad5e93;p=mobile-ledger.git Misc.showSoftKeyboard: handle fragemtn.getActivity() returning null --- diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java index bbfa828b..b28900f9 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -22,6 +22,7 @@ import android.content.res.Configuration; import android.view.WindowManager; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; 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) { - showSoftKeyboard(fragment.getActivity()); + final FragmentActivity activity = fragment.getActivity(); + if (activity != null) + showSoftKeyboard(activity); } }