mirror of https://github.com/libsdl-org/SDL
Fixed java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.WindowManager android.app.Activity.getWindowManager()' on a null object reference
This commit is contained in:
parent
27889d0261
commit
37faac0d81
|
@ -1012,6 +1012,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue