Prevent screen rotation on Android
Add android:screenOrientation=”portrait” or android:screenOrientation=”landscape” to the <activity> element/s in the manifest and you’re done.
Add android:screenOrientation=”portrait” or android:screenOrientation=”landscape” to the <activity> element/s in the manifest and you’re done.
Use: Intent intent = new Intent(getApplicationContext(), Home.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); This will clear all the activities on top of home. Assuming you are finishing the login screen when the user logs in and home is created and afterward all the screens from 1 to 5 on top of that one. The code I posted will return … Read more
Download and install latest version of Xcode. Set a Launch Screen File for your app (in the general tab of your target settings). This is how you get to use the full size of any screen, including iPad split view sizes in iOS 9. Test your app, and hopefully do nothing else, since everything should … Read more
How can one get the dimensions of the screen in iOS? The problem with the code that you posted is that you’re counting on the view size to match that of the screen, and as you’ve seen that’s not always the case. If you need the screen size, you should look at the object that … Read more
If you want the display dimensions in pixels you can use getSize: Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; If you’re not in an Activity you can get the default Display via WINDOW_SERVICE: WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); If you … Read more