mirror of
				https://github.com/encounter/SDL.git
				synced 2025-10-25 19:20:25 +00:00 
			
		
		
		
	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() { |     public static boolean isTablet() { | ||||||
|         DisplayMetrics metrics = new DisplayMetrics(); |         DisplayMetrics metrics = new DisplayMetrics(); | ||||||
|         Activity activity = (Activity)getContext(); |         Activity activity = (Activity)getContext(); | ||||||
|  |         if (activity == null) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|         activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); |         activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); | ||||||
| 
 | 
 | ||||||
|         double dWidthInches = metrics.widthPixels / (double)metrics.xdpi; |         double dWidthInches = metrics.widthPixels / (double)metrics.xdpi; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user