android-configchanges

Rotation of screen crashes android app [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-10 10:28:06
问题 This question already has answers here : Background task, progress dialog, orientation change - is there any 100% working solution? (8 answers) Closed 6 years ago . I am new to android development. I have developed one app, now the problem is that whenever I rotate screen, app starts activity again and then its crashes application. I found some solution on google to use android:configChanges="orientation" . It works fine but when I rotate screen, its screen size does not change. How to solve

“Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden| orien”… in AndroidManifest.xml

为君一笑 提交于 2019-12-08 16:47:22
问题 Before all, i am a rookie in Android, and i am using API 10 (Gingerbread). I am developing a simple game with libgdx. But i just install everything for start to work and... in the AndroidManifest.xml this line: android:configChanges="keyboard|keyboardHidden|orientation|screenSize" Got the next error in console:_ error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenSize'). I have found in Stackoverflow this answer, i changed to API 13

Why is my Orientation Change Going Unnoticed?

一世执手 提交于 2019-12-08 08:01:44
问题 Based on the accepted answer here, I added this code to an Activity as what I hoped to be the first step in changing the assigned Layout for an Activity: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show(); setContentView(R.layout.activity_settings_landscape); } else

How to get android video capture to survive screen rotation

断了今生、忘了曾经 提交于 2019-12-06 10:51:31
I have managed to get Video capture to work for a custom camera experience (i.e. using MediaRecorder, Camera, SurfaceView, etc.). But if I am recording a video and change the orientation of the device, video capture stops. Is there way to continue the capture after the orientation change? If fact I want the capture to continue no matter how many times the orientation changes. I imagine it might all have to do with savedInstanceState and saving the file that I pass to mRecorder.setOutputFile(my file) . If that's correct, what else am I missing? Or is there a more standard way to handle

onSaveInstanceState() vs. onRetainCustomNonConfigurationInstance()

十年热恋 提交于 2019-12-05 21:52:27
I am using ActionBarSherlock, along with several MenuItem s that I dynamically manage, depending on program state. Specifically, I save the MenuItem s into instance variables in the Activity 's onCreateOptionsMenu() method, and then can show and/or hide them as needed later in the Activity . However, I found that the MenuItem variables can be lost on configuration changes, such as device rotation. So I also put them into a Parcel and pass them to onSaveInstanceState() for restoral through the savedInstanceState mechanism in the next onCreate() call, if needed. This seems to work fine in the

Fragment recreated every time after orientation change, unable to restore state

天涯浪子 提交于 2019-12-05 03:05:40
Update: It turns out that the problem is from elsewhere. Thanks @Luksprog for pointing out what I overlooked. The project is created using Android Studio's navigation drawer pattern. The drawer is implemented in the NavigationDrawerFragment class. The fragment holding the view pager is added when a particular item in the drawer is selected. The code is implemented my home activity. When screen rotates, the onCreate() method of NavigationDrawerFragment is called, preserving last selected item. And here is what went wrong - upon recreation, NavigationDrawerFragment will call selectItem() again,

“orientation|keyboardHidden” not calling onConfigurationChanged

只愿长相守 提交于 2019-12-02 01:42:48
问题 I want to know when the keyboard is closed, so I'm using android:configChanges="orientation|keyboardHidden" . I have to override the method onConfigurationChanged , but nothing seems to happen. Am I doing something wrong? 回答1: watching the date , possibly you have a solution for your question, otherwise: Here is the same response i made to another question related : Is there a way to tell if the soft-keyboard is shown? but i copy a portion of the response here to avoid dead links: Here is a

“orientation|keyboardHidden” not calling onConfigurationChanged

蓝咒 提交于 2019-12-01 23:40:30
I want to know when the keyboard is closed, so I'm using android:configChanges="orientation|keyboardHidden" . I have to override the method onConfigurationChanged , but nothing seems to happen. Am I doing something wrong? yeradis watching the date , possibly you have a solution for your question, otherwise: Here is the same response i made to another question related : Is there a way to tell if the soft-keyboard is shown? but i copy a portion of the response here to avoid dead links: Here is a specific sample : Check for a better understand http://developer.android.com/guide/topics/resources

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

吃可爱长大的小学妹 提交于 2019-12-01 03:20:50
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 change happens quite some time after the configuration change - i.e., the dimensions are not correct

Getting “Fragment did not create a view” after addition of other Fragment without UI

旧城冷巷雨未停 提交于 2019-11-30 13:00:56
I'm having a really weird problem. I have a common fragment that is added in almost every activity of my app. This fragment shows a small version of the player bar. So it listens some broadcasts to update the current music's name and has some controls, like play/pause. Like I said, I add this fragment in almost every activity of my app and I've never had any problem with it. But now, I needed to create a new Fragment that has no UI and that is retained (setRetainInstance(true)). After the addition of this new Fragment, everything seemed to be ok. Until I rotated the device and the activity