Skip to content
Permalink
Browse files

Fixed java.lang.NullPointerException: Attempt to invoke virtual metho…

…d 'android.view.WindowManager android.app.Activity.getWindowManager()' on a null object reference
  • Loading branch information
slouken committed Mar 5, 2020
1 parent 27889d0 commit 37faac0d815c10dd2abf8491bd743433c446e2cc
Showing with 3 additions and 0 deletions.
  1. +3 −0 android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -1012,6 +1012,9 @@ public static boolean isAndroidTV() {
public static boolean isTablet() {
DisplayMetrics metrics = new DisplayMetrics();
Activity activity = (Activity)getContext();
if (activity == null) {
return false;
}
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);

double dWidthInches = metrics.widthPixels / (double)metrics.xdpi;

0 comments on commit 37faac0

Please sign in to comment.