screen-orientation

How to detect when the device switch from portrait to landscape mode? [duplicate]

空扰寡人 提交于 2019-11-27 21:41:09
This question already has an answer here: How to detect orientation change in layout in Android? 9 answers I have an app which shows fullscreen bitmaps in an activity. In order to provide fast loading time, I load them in the memory. But when the screen changes orientation, I would like to clear the cache in order to fill it again with bitmaps that fit inside the new dimensions. The only problem is that in order to do this, I need to detect when an orientation change occurs. Do anyone know how to detect this? See the official documentation http://developer.android.com/guide/topics/resources

Camera capture orientation on samsung devices in android

南笙酒味 提交于 2019-11-27 20:44:56
I am creating a camera app. The image when captured is shown in the grid view. Now, the code is working completely fine on all the devices except for samsung devices. I am facing the orientation issue. When I capture an image in a portrait mode, the image rotates when displayed in the gridview. I have not kept any rotate code. Secondly, with the EXIF I achieved the proper image in the grid view but when the device orientation changes, again the image rotates in a wiered fashion. Attaching images: Sorry for the resolution of the image. Please lemme know if they are not visible properly. Will

Change screen orientation in Android without reloading the activity

十年热恋 提交于 2019-11-27 17:10:12
问题 I want to change the orientation programmatically while running my Android App, with these lines of code: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); They work so far, but the main problem is that the whole activity is reloaded when the screen orientation changes, and I don't want that. Is it possible? Thanks. EDIT: OK, after I while I found out what I was missing. I had to include also

android:screenOrientation tag in application does not work

只谈情不闲聊 提交于 2019-11-27 16:16:31
问题 The android:screenOrientation tag when placed in <application> does not work. But when I put android:screenOrientation in a <activity> tag it works. If android:screenOrientation tag works in <application> then, there would no need to put android:screenOrientation handling for every activity. I wonder, why there is such strange behavior in Android platform for screenOrientation tag? 回答1: The <application> element does not support android:screenOrientation . You can tell this by reading the

How to stop changing the orientation when a progress bar is spinning in android

 ̄綄美尐妖づ 提交于 2019-11-27 15:03:42
I have a Registration screen where user enters all the registration details and when user clicks on the "Register" button i am showing the progress bar(Progress bar begins to spin) and then takes the user to the home screen.If the user rotates the phone when progress bar is spinning, the progress bar gets dismissed.I want the orientation not to change from potrait to landscape and vice versa,when a progress bar is visible(meaning it is spinning).How to stop the orientation change when progress bar is spinning?Any help would be appreciated. This is happening because when screen orientation

Is the setDisplayOrientation sample code correct?

Deadly 提交于 2019-11-27 14:39:57
问题 The documentation page for Camera.setDisplayOrientation contains the following code sample stating that using it will "make the camera image show in the same orientation as the display": public static void setCameraDisplayOrientation(Activity activity, int cameraId, android.hardware.Camera camera) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, info); int rotation = activity.getWindowManager()

Orientation change in Honeycomb

浪尽此生 提交于 2019-11-27 14:38:43
问题 I have an activity that shouldn't be recreated after an orientation change. I added the following to the activity declaration in the manifest: android:configChanges="orientation" On Android 2.3 this works perfectly. On HONEYCOMB_MR2 onCreate is called anyway when change the orientation. Is there something else that needs to be done on HONEYCOMB_MR2 to prevent recreating the activity after an orientation change? 回答1: Apparently using orientation|screenSize (?) prevents onCreate on Honeycomb

How to detect my screen orientation in portrait locked screen in android?

梦想的初衷 提交于 2019-11-27 14:27:45
I want to find the camera screen orientation in locked portrait orientation mode, well I am using camera in my fragment class and I have already set my screen orientation as portrait, but the problem I am facing is, when I turn my camera from portrait to landscape its getting changed and I need to set capture button visible only when the camera is in portrait mode. Can anyone help me to get the orientation changes in portrait mode? Below is my code: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); sensorManager.registerListener(new SensorEventListener() { int

Activity in portrait or reverse portrait only

馋奶兔 提交于 2019-11-27 14:22:10
I want my activity to be available only in both portrait modes - portrait and reversePortrait. How can I achieve this? When I set android:screenOrientation="portrait" it will force activity to be only in normal portrait - vice versa with reversePortrait. Please, don't tell me it's a bad approach to force/lock orientation. I know about it, but still client is requesting it. Thanks for understanding and for any ideas. UPDATE: API Level 11 and higher If you are on API level 9+, use android:screenOrientation="sensorPortrait" . Portrait orientation, but can be either normal or reverse portrait

Android: Disable rotations by 90°, but enable rotations by 180°

落爺英雄遲暮 提交于 2019-11-27 13:04:15
问题 I would like to create an Android app (for a tablet) that should be only displayed in landscape orientation, e.g. the app should ignore rotations by 90°, but support rotations by 180°. Adding android:screenOrientation="landscape" in the manifest causes the app to ignore all rotations, (even the 180° rotations), i.e. rotating the device by 180° shows the application upside down. Without the android:screenOrientation attribute my app is displayed "correctly" in all four positions. Rotation the