android-orientation

Android - switching between landscape and portrait mode makes Intent lose values

余生颓废 提交于 2019-11-27 19:25:13
I am using Intents to switch between activities in my Android app. I am putting data in the Intent for use in the next activity. When I switch the phone between landscape and portrait modes, the values passed from the intent are lost and I get a NullPointerException. Can someone please tell me what could be wrong. There's a lot of code to post it entirely. But if someone needs to look at specific parts of code, I can post it here. Edit I solved the issue of state not being saved. But another problem I faced is that none of the buttons on the screen work after the orientation has been changed.

OpenCV camera orientation issue

给你一囗甜甜゛ 提交于 2019-11-27 18:12:39
I have a simple project that just show the camera with org.opencv.android.JavaCameraView. my problem is that in default the camera is on landscape mode and I can't change this cause I need to define CameraBridgeViewBase instead of a regular camera intent. this is a part of my code: XML code: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" > <org.opencv.android.JavaCameraView android:layout_width="fill_parent" android:layout_height="300dp" android:visibility="gone" android:id="@+id/HelloOpenCvView" opencv:show_fps="true" opencv:camera_id="1" /> <

prevent activity restarting when orientation changes

社会主义新天地 提交于 2019-11-27 14:25:18
I am new to android development .I have separate screens for portrait and landscape mode.When i change my orientation corresponding screen gets loaded and activity restarts . Now i do not want my activity to restart when i change the orientation but should load its corresponding screen(axml). I have tried [Activity (Label = "MyActivity",ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation)] the above line stops activity getting restarted but it loads the same screen(axml). Please suggest . thanks Write this code in your activity @Override public void onConfigurationChanged

Android orientation change calls onCreate

隐身守侯 提交于 2019-11-27 09:04:16
I've made a search screen that has one tab for keywords, filters, and a search button, and three optional tabs for the different types of results (each containing a ListView with an ArrayAdapter ). When starting the activity, the developer can optionally pass in the results as an extra Parcelable[] if the search has already been performed. In the onCreate() method I'm creating each of the three tabs for the Parcelable[] passed through. When I call a search from the button on the filter tab, I clear the tabs and recreate them with the new results, which works perfectly. The problem is that when

Android emulator not rotating to landscape

走远了吗. 提交于 2019-11-27 07:34:30
When i try to switch the orientation of my emulator, the emulator window rotates and the orientation of the emulator screen stays as it were. Can anyone tell me what is the reason for this ?I have tried all the answers from StackOverflow and nothing seem to help Amritha Some of the emulator targets like 4.4 (API level 19) and 2.3 have a bug. Change your emulator to target version 4.2 or 4.3 and try to change the orientation. See the history of this bug: https://code.google.com/p/android/issues/detail?id=13189 Related question: Impossible to rotate the emulator with android 4.4 trakos If

Change orientation at runtime

冷暖自知 提交于 2019-11-27 03:21:19
问题 I'm new to android my question is, Is it possible to change orientation programmatically? If yes, how can we do that? 回答1: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Also add this in your manifest file (under activity): android:configChanges = "orientation" 回答2: Yes, use setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); to force orientation 回答3: yes this one possible

Allow rotation/landscape in one fragment

 ̄綄美尐妖づ 提交于 2019-11-27 00:55:32
问题 My app has a single Activity with a FragmentPagerAdapter with four fragments (Using the ViewPagerIndicator library). One of these fragments has designs for both a separate portrait and landscape layout, the other three do not and need to be fixed to portrait orientation. My thought was to set android:configChanges="orientation" in the manifest and call getActivity().setRequestedScreenOrientation() in the onResume() of all the fragments, locking to SCREEN_ORIENTATION_PORTRAIT in three of them

Camera capture orientation on samsung devices in android

两盒软妹~` 提交于 2019-11-26 22:58:21
问题 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

Android orientation change calls onCreate

≯℡__Kan透↙ 提交于 2019-11-26 22:18:11
问题 I've made a search screen that has one tab for keywords, filters, and a search button, and three optional tabs for the different types of results (each containing a ListView with an ArrayAdapter ). When starting the activity, the developer can optionally pass in the results as an extra Parcelable[] if the search has already been performed. In the onCreate() method I'm creating each of the three tabs for the Parcelable[] passed through. When I call a search from the button on the filter tab, I

Android Activity, how to override manifest's android:configChanges with Java code?

ⅰ亾dé卋堺 提交于 2019-11-26 21:54:27
问题 I'm coding a custom Activity class (using it as a super class for my other Activity classes) where it's overriding many default functionalities. One of these functionalities I want is orientation handling, and while I can do it, it requires android:configChanges="orientation" in the manifest. Is there a way to enforce the same thing as the line above, but in java code? 回答1: You'll still need to include the attribute in the XML but you can handle it in Java too; see my blog post here: http:/