screen-orientation

How to prevent Screen Orientation change when Activity finishes on Android 8.1 Version Devices?

ε祈祈猫儿з 提交于 2019-12-10 12:35:38
问题 I'm working on an app and encountered a strange behavior on 8.1 Devices (Pixel2, Nexus5x), so I wrote a small App to verify this behavior. MainActivity is locked to portrait mode while LandscapeActivity is locked to landscape . MainActivity starts the LandscapeActivity for Result. Screen Switches from portrait to landscape as expected. When LandscapeActivity is finished it propagates the Result to MainActivity , while switching back to portrait (as expected). But Sometimes I encounter kind of

programmatically setting orientation in viewdidload is not working

巧了我就是萌 提交于 2019-12-10 11:57:19
问题 I have created an app for ipad in which the homescreen should be displayed only in portrait mode. So i have used the below code in viewdidload. [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait]; but it is not working. I am using ios 7 with xcode 5. If i open my app from landscape mode it shouuld automatically turn to portrait mode. but i am getting like this: but it should be like this: can any one help me to solve this issue. Thanks in advance. 回答1: [[UIDevice

Some devices are taking different orientation (for brief moment) then what I set in Manifest

吃可爱长大的小学妹 提交于 2019-12-10 11:02:34
问题 I have checked every possible solutions in all stack overflow solutions and other web sites also but no luck. My Requirement is : Phone - only portrait mode Tablet - portrait and landscape mode. So tried using following: For finding device if it is a Phone or a Tablet I used if (getResources().getBoolean(R.bool.is_sw_600dp_size)) { intent = new Intent(LauncherEmptyActivity.this, SplashActivityTablet.class); } else { intent = new Intent(LauncherEmptyActivity.this, SplashActivity.class); } And

Detecting device orientation change using android:screenOrientation

对着背影说爱祢 提交于 2019-12-10 10:59:38
问题 Is there a way to detect device orientation events or at least to get the current device orientation while using android:screenOrientation in the manifest ? I mean device orientation not application orientation. My problem is I really want to keep my application in portait mode (it's a web view) but I want to handle orientation change myself in my app. When android:screenOrientation is setted, orientation getted by methods is always the application orientation, not the device orientation.

Is it possible to execute ADB shell commands from app?

牧云@^-^@ 提交于 2019-12-10 10:17:59
问题 I have an Android PC with root (out-of-box) connected to an external monitor (HDMI & USB) that always displays in landscape, even though my app specifies portrait in the activity declaration in Manifest: android:screenOrientation="portrait" I am trying to execute the following command from this SO post to force portrait: proc = Runtime.getRuntime().exec("adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0"); int exitVal = proc.waitFor(); This

Javascript get mobile screen width after orientation change

此生再无相见时 提交于 2019-12-09 12:13:08
问题 I am capturing the orientationchange event like this: $(window).bind( 'orientationchange', function(e){ }); How can I get the new screen width and height in pixels after the orientationchage ? I have tried screen.width but this doesn't change, it remains as the initial width, even after orientation change. 回答1: $(window).bind( 'orientationchange', function(e){ var ori = window.orientation, width = (ori==90 || ori==-90) ? screen.height : screen.width; }); 回答2: Also you can use screen

Get Current Fragment and Save on onSaveInstanceState() Method For Screen Orientation

隐身守侯 提交于 2019-12-09 04:44:18
问题 I have one Activity with multiple Fragments. I am also using actionbarSherlock for my tabs which also connected to fragments. My Problem is when I am going to rotate the screen (that is portrait to landscape/vice-versa), my activity will be called again so it restarts my activity. I want not to restart my activity but just restore the current fragment that was shown before it was rotate. PLEASE don't answer android:configChanges="orientation|keyboardHidden" since it does not solved the issue

Do something right before Screen Rotation?

二次信任 提交于 2019-12-08 14:42:31
问题 i want to do_something() whenever the device rotates from Portrait to Landscape. i have added <activity android:configChanges="orientation" > in my manifest. So onConfigurationChanged() will be called whenever i rotate my device. And it will not re-create the Activity. In my onConfigurationChanged() function: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { do

How to stop rotation of ABPersonViewController & ABNewPersonViewController in Landscape mode in iphone

余生颓废 提交于 2019-12-08 12:56:36
问题 I am using a ABPersonViewController and ABNewPersonViewController class by pushview controller. ABPersonViewController *pvc = [[ABPersonViewController alloc] init]; [pvc setPersonViewDelegate:self]; [[self navigationController] pushViewController:pvc animated:YES]; In ABPersonViewController and ABNewPersonViewController page it is displaying in portrait mode. But when I rotate my iPhone then it is perfectly rotating in landscape mode. But I want to stop this rotation. If I rotate my iPhone in

Storyboards Orientation Support in Xcode 4.5 and iOS 6.x ?

萝らか妹 提交于 2019-12-08 11:56:40
问题 I've created two storyboards both identical except one contains portrait views and one contains landscape views. I don't want to use autoresize masks because the layout of some of the views changes completely between portrait and landscape. I've manually moved controls on the view in code in the past but I was after an easier way this time :) The closest solution I've found was from 'benyboariu' - Storyboards orientation support for xCode 4.2? Here's the code I'm using which works fine on iOS