android-orientation

How to keep Popup window opened when orientation changes at run time in Android?

拈花ヽ惹草 提交于 2019-12-18 05:57:44
问题 I have created a Popup window which contains month view to pick up date. When I changes orientation, due to Android loads an activity all over again my popup Window gets disappears. How can I make it opened even when orientation changes at runtime? 回答1: include android:configChanges="orientation" in your AndroidManifest.xml to the activity displaying window. Doing this tells android that you are going to handle orientation change yourself and eventually it will not destroy your activity and

prevent activity restarting when orientation changes

流过昼夜 提交于 2019-12-17 11:52:24
问题 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

Android emulator not rotating to landscape

♀尐吖头ヾ 提交于 2019-12-17 09:30:28
问题 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 回答1: 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

Force an Android activity to always use landscape mode

我怕爱的太早我们不能终老 提交于 2019-12-17 02:06:32
问题 I am using the Android VNC viewer on my HTC G1. But for some reason, that application is always in landscape mode despite my G1 is in portrait mode. Since the Android VNC viewer is open source, I would like know how is it possible hard code an activity to be 'landscape'. I would like to change it to respect the phone orientation. 回答1: Looking at the AndroidManifest.xml (link), on line 9: <activity android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" android

Android strange behavior on orientation change with Custom View in fragment

喜夏-厌秋 提交于 2019-12-14 03:48:39
问题 I have a FragmentActivity which shows a Fragment by defualt. The fragment consists of an EditText , a TextView and a Custom DropDown, made by extending AutoCompleteTextView . If my custom AutoCompleteTextView is focused or the drop down list is open and I change the orientation of the device. I get following exception: Failed Looking up window java.lang.IllegalArgumentException: Requested window null does not exist It works if the custom AutoCompleteTextView is not in focused state. I've

orientation android

此生再无相见时 提交于 2019-12-13 22:19:40
问题 I want to add orientation on my app but I need that--> when my phone on PORTRAIT style works A activity and when I change PORTRAIT style as LANDSCAPE style A activity stops and B activity starts.How can I handle this? Thanks... 回答1: if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { } if (getResources().getConfiguration().orientation ==Configuration.ORIENTATION_LANDSCAPE) { } 回答2: do this @Override public void onConfigurationChanged(Configuration

How to rotate a view from different angles?

浪尽此生 提交于 2019-12-13 19:36:31
问题 I am trying to rotate an ImageButton by 180 degrees so it matches the reverse portrait orientation. When I did this the same way as the other orientation changes, the result was perfect, but not the animation. public void onOrientationChanged(int DeviceAngle) { float MyButtonCurrentAngle = MyButton.getRotation(); //Gets portrait rotation (0) if(DeviceAngle > 350 || DeviceAngle < 10) { //Portrait MyButton.animate().rotationBy(- MyButtonCurrentAngle).setDuration(100).start(); } else if

Textview stops updating its contents after orientation change

安稳与你 提交于 2019-12-13 17:12:36
问题 As the title says, I'm having trouble when updating the contents on my Textview. It all works well, until I change the orientation. Here is the onCreate of the Activity that holds the Textview: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.transacao); screenTextView = (TextView) findViewById(R.id.lblStatusTrn); screenTextView.setText(screenMessage); //... } And here is

Android: how do I prevent class variables being cleared on orientation change [duplicate]

半腔热情 提交于 2019-12-13 10:08:59
问题 This question already has answers here : Android save state on orientation change (2 answers) Closed 3 years ago . I have a main activity which has two configurations, one which will display a fragment which is locked to portrait orientation. When a button is clicked on this fragment, a fragment replaces it, however this new fragment can be displayed landscape with a second fragment side-by-side. This all works fine, however I am intercepting back-navigation in the second state so that I can

Android device angle on vertical axis while device stays still

ⅰ亾dé卋堺 提交于 2019-12-13 02:41:14
问题 I am developing my first app and for some calculations I need an angle of vertical axis. Basically I am trying to make simple measure tool which would do the calculations on Button click. I have height(H) in which is device and I need angle of device vertical axis. Having these values I'll be able to calculate sin and so on. I tried to use code from this link (finding orientation using getRotationMatrix() and getOrientation()) to get values, but it crashes and also I think it's not the values