android-orientation

how i can break things with Fragments with setRetainInstance(true) and adding them to backstack?

时光毁灭记忆、已成空白 提交于 2019-11-29 20:12:05
the docs on setRetainInstance say : This can only be used with fragments not in the back stack. so I started playing with it. I have one Activity with adds first frag A FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content, new PackageFragment()); ft.commit then from this frag I run a method from parent Activity which adds frag B to backstack FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content, new OrderFragment()); ft.addToBackStack(null); ft.commit(); then

Activity orientation changes automatically on Android

天涯浪子 提交于 2019-11-29 18:01:40
问题 I'm developing a mobile application based on Android with minSdkVersion=15 . I would like to support both orientations for tablets and only portrait for smartphones. Everything works like a charm but I'm experiencing a little bug that is driving me crazy. When smartphone is in landscape mode and I try to trigger a new Activity, it opens in landscape mode for a while and then autorotates to portrait. Each one of my activities extend a GeneralActivity class: public class GeneralActivity extends

orientation is not working in 2.3.3?

不问归期 提交于 2019-11-29 15:48:59
I have prepared one application.My application will be supports both landscape and portrait. When i change the orientation from portrait to landscape it is working fine,But when i change landscape to portrait it is not working.my code is, public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); System.out.println("orientation---"+getResources().getConfiguration().orientation); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { setContentView(R.layout.main); System.out.println("landscape-----"); } else if (newConfig.orientation ==

Tab Widget Issue when use android:configChanges=“orientation|keyboardHidden” in Grid View but working for other Tab

三世轮回 提交于 2019-11-29 15:24:53
I am stuck with my issue.Thing is that its a custom Tab Widget.In that have multiple tab like Home - News - Abc - PQR . The Activity should be for both orientation like portrait and landscape . so for that each tab have two xml for portrait which is store at layout-port/file.xml and landscape which store at layout-land/file.xml For manage orientation portrait to landscape i have added android:configChanges="orientation|keyboardHidden" rule tag in each activity. TAB_SAMPLE.java Tab file. TAB_GROUP_ACTIVITY each Tab Group activity File file.java Task file After all this stuff i get issue here :

Best way to persist data between orientation changes in Android

可紊 提交于 2019-11-29 15:15:39
My education application is having a tab host with 6 to 7 tabs with landscape and portrait modes support. In each and every activity associated with a tab, I am showing some student records in list view, with some check boxes for selection and some rating bars, buttons etc. I am getting these student records from remote server through web service call. For some reasons, my app will show one initial relative layout with some buttons after doing some actions/searches It will show results in list view, upon clicking list item or buttons in list view I am showing some other layout. This applies to

Force portrait mode in camera

十年热恋 提交于 2019-11-29 10:43:46
I am invoking a camera using an intent and clicking a picture. Presently I am on emulator and would like to force camera to click the pictures in portrait mode(need to capture a video of app working,so orientation change would look bad) but the camera screen appears landscape and all the further activities which I invoke in onActivityResult(). After clicking the picture the Activity layout comes out in landscape mode like this: while all my previous activity have displayed correctly in portrait orientation. I tried adding android:screenOrientation="portrait" android:configChanges="orientation

Setting Android Photo EXIF Orientation

这一生的挚爱 提交于 2019-11-29 09:46:54
问题 I have written an Android activity that captures a photo programatically. I want to save the image as a JPEG with the correct EXIF orientation data (just like the native Android Camera app does automatically). Here is the method for actually taking the photo (I removed the try/catch blocks): private void takePhoto() { camera = Camera.open(); SurfaceTexture dummySurfaceTexture = new SurfaceTexture(0); camera.setPreviewTexture(dummySurfaceTexture); camera.startPreview(); camera.takePicture(null

How to create a BottomBar as StickyBottomCaptureLayout in camera2 Android api?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 08:30:15
Context: In the android-7.1.1_r12 api, the android.hardware.camera2 uses a StickyBottomCaptureLayout as a "BottomBar" to display the action buttons (as switch-camera, shutter and recent picture buttons). Whatever the device orientation, this StickyBottomCaptureLayout is displayed always above/near the system bar (which has back, home and other apps buttons). For example, this is what it looks when the rotation degree is 0 or 180 : And, by orienting the device and get a rotation degree as 90 or 270 , the StickyBottomCaptureLayout is now near the system bar: Usually, this above screenshot should

how to save state with onSaveInstanceState and onRestoreInstanceState while orientation change

爱⌒轻易说出口 提交于 2019-11-29 08:12:48
I read almost all article about onSaveInstanceState and onRestoreInstanceState in Stack overflow but I cant solve my problem. I have a text view and button in my main.java and while you click on button value of a ( a is an int variable) variable will increase and show in the text view, but, when I rotate my phone ( orientation change), text view reset. I override onSaveInstanceState and onRestoreInstanceState but it doesn't work. one more thing, I have special layout-land.xml file for landscape view. here is my code import android.app.Activity; import android.graphics.Typeface; import android

Android Fragments recreated on orientation change

纵然是瞬间 提交于 2019-11-29 05:50:54
I'm developing an app that basically has an ActionBar. When my app starts, the Activity creates the fragments and attaches them to each tab, so when I switch I get different views. The problems arise when I try to rotate the device. After some struggle, I noticed that Android automatically recreates the previously added fragments like this: SummaryFragment.onCreate(Bundle) line: 79 FragmentManagerImpl.moveToState(Fragment, int, int, int) line: 795 FragmentManagerImpl.moveToState(int, int, int, boolean) line: 1032 FragmentManagerImpl.moveToState(int, boolean) line: 1014 FragmentManagerImpl