android-orientation

App shows main screen after screen rotation

南笙酒味 提交于 2020-01-05 04:57:39
问题 I have been working on an andoid app since a few days. I have two layouts in my MainActivity, first one shows SearchBox and second shows the Results. When the app shows the results and the app orientation is changed, the app get back to the first screen. I may not be clear with my engish but see these simple steps : Open App -> 1st screen(MainActivity) -> 2nd Screen(MainActivity) -> Now If I rotate the screen It goes back to 1st screen. I searched on internet about it, but I was unable to

App shows main screen after screen rotation

让人想犯罪 __ 提交于 2020-01-05 04:57:10
问题 I have been working on an andoid app since a few days. I have two layouts in my MainActivity, first one shows SearchBox and second shows the Results. When the app shows the results and the app orientation is changed, the app get back to the first screen. I may not be clear with my engish but see these simple steps : Open App -> 1st screen(MainActivity) -> 2nd Screen(MainActivity) -> Now If I rotate the screen It goes back to 1st screen. I searched on internet about it, but I was unable to

Android getOrientation() returns azimuth, positive or negative?

大城市里の小女人 提交于 2020-01-04 04:26:06
问题 Assumption : the phone is held flat (parallel with the ground). I am using getRotationMatrix() and getOrientation (float[] R, float[] values) to get the azimuth. Under this assumption, the azimuth is simply values[0] . The documentation says: All three angles above are in radians and positive in the counter-clockwise direction. Then I checked, when my phone's y axis points to the North , the azimuth is indeed 0 . However, here comes the problem: when my phone's y axis points to West , i.e. I

android fragment created twice on orientation change

拈花ヽ惹草 提交于 2020-01-03 07:29:54
问题 i am having this weird problem where my list fragment is created twice, once when the super.oncreate is called on the parent activity and once when the setContentView is called on the same parent activity. It is a simple application where i use different layout for portrait and landscape orientation. Here is the main activity: private HeadlinesFragment headlines; @Override public void onCreate(Bundle savedInstanceState) { Log.w("MainActivity", "Before super.onCreate: " + this.toString());

Why does onLayout and onSizeChanged get called twice on an orientation change?

吃可爱长大的小学妹 提交于 2019-12-30 08:15:07
问题 I've noticed that onLayout and onSizeChanged get called twice in immediate succession after an orientation change, either from landscape->portrait or from portrait->landscape, when handling the configuration change from an Activity. Furthermore, the first onLayout/onSizeChanged contain the old dimensions (before the rotate), while the 2nd onLayout/onSizeChanged contain the new (correct) dimensions. Does anyone know why, and/or how to work around this? It seems like perhaps the screen size

orientation is not working in 2.3.3?

微笑、不失礼 提交于 2019-12-29 08:53:05
问题 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) {

Memory increase on each orientation change, using two different layouts

时光怂恿深爱的人放手 提交于 2019-12-25 01:19:14
问题 I'm using different layouts for portrait and landscape modes. Is memory increasing each time orientation is changed if I'm using two different layouts? How to use same memory or free activity memory load previously? I used: <activity android:name=".LoginOnline" android:configChanges="orientation|keyboardHidden" > in activity in manifest file and override onconfigurationchanged method to prevent activity recreate but memory is still not released! public void onConfigurationChanged

Need help on rotating image view with animation on orientation change (4 side rotation) in android

北城以北 提交于 2019-12-24 15:27:57
问题 i have a image view and i need to rotate(with IOS like animation) the image view on orientation change in android(portrait,landscape,reverse portrait and reverse landscape). please advice void rotateAndSet(int angle) { if (currentAngle != angle || currentImage != currentBaseImage) { // This // is // to // remove // unnecessary // drawing currentAngle = angle; currentImage = currentBaseImage; myImg = decodeBase64(currentBaseImage); matrix = new Matrix(); matrix.postRotate(angle); Bitmap

how to determine device orientation from the sensors

断了今生、忘了曾经 提交于 2019-12-24 15:19:43
问题 My activity is locked on LANDSCAPE. But still I need to know the orientation of the device. So I have elected to use sensors. I have the following code sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL); ... @Override public void onSensorChanged(SensorEvent event) { float[] values = event.values; // Movement float azimuth = values[0]; float pitch =

android Fragment issue with orientation change

安稳与你 提交于 2019-12-24 14:34:59
问题 I have activity and two layouts for it defined: layout-large-land layout 1st layout is for large screens in landscape mode, 2nd is for other cases. The 1st layout contains: fragment1 fragment2 The 2nd layout contains: fragment1 When I start the app in landscape mode on large screen, the getSupportFragmentManager().findFragmentById() called in Activity.onCreate() correctly returns both fragments. After orientation change to portrait, getSupportFragmentManager().findFragmentById() returns not