Questions tagged [onconfigurationchanged]

153 questions
105
votes
9 answers

Restoring state of TextView after screen rotation?

In my app I have TextView and EditText. Both have data in it. When the screen orientation changes the data in the EditText remains, but TextView data is cleared. Can some one help me out to find a way to retain data in TextView too?
95
votes
13 answers

Prevent dialog dismissal on screen rotation in Android

I am trying to prevent dialogs built with Alert builder from being dismissed when the Activity is restarted. If I overload the onConfigurationChanged method I can successfully do this and reset the layout to correct orientation but I lose sticky…
draksia
  • 2,280
  • 1
  • 18
  • 23
24
votes
3 answers

android : How to prevent resizing the window when displaying the virtual keyboard

I am using a tabbed application. There is an EditText my application. When I click on the EditText, the window is getting resized and the virtual keyboard is displaying at the bottom of the window. But the four tabs are displaying at the top of the…
Jomia
  • 3,416
  • 10
  • 44
  • 63
21
votes
3 answers

How to get NEW width/height of root layout in onConfigurationChanged?

One of our views has a ScrollView as its root layout. When the device is rotated and onConfigurationChanged() is called, we'd like to be able to get the ScrollView's new width/height. Our code looks like this: @Override public void…
jakeboxer
  • 3,120
  • 3
  • 24
  • 27
18
votes
2 answers

Android: Stop Recreating the activity on orientation change

I have a listview with two buttons in my main.xml layout. On click of one button i'am creating a textview dynamically and adding it at the bottom of the screen to confirm the user interaction. When the user clicks 2nd button (Confirm button), i need…
sachi
  • 2,032
  • 7
  • 29
  • 44
16
votes
1 answer

Using onConfigurationChanged in a fragment

I have this code in a fragment public class TestOne extends Fragment { View view = null; @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); LayoutInflater…
15
votes
8 answers

Best way to store SparseBooleanArray in Bundle?

When a config change happens, my ListView Checkbox states get lost, which I understand why. I try to implement public void onSaveInstanceState(final Bundle outState) in one of my Fragments. So I'm just wondering what's the easiest way to store my…
Kitesurfer
  • 3,263
  • 2
  • 25
  • 41
10
votes
3 answers

Crash when resuming Activity due to NPE

I've observed some crashes among the users of my app which is related to a configuration change and the Activity being recreated, I was not able to reproduce it. The issue seems to be inside the Android classes and therefore there's no chance for me…
devgianlu
  • 1,484
  • 10
  • 21
10
votes
5 answers

Android Layout land not working

I've been looking at issues in stackoverflow and I've tried everything I've seen but the layout-land not work. In my code I have and the method onConfigurationChanged @Override public void onConfigurationChanged(Configuration newConfig) { …
9
votes
2 answers

View layout doesn't refresh on orientation change in android

I'd like my VIEW layout to be adjusted on orientation change. My Manifest is set up with: android:configChanges="keyboardHidden|orientation" on the activity. I have res/layout-land, res/layout-port. I have onConfigurationChanged in my Activity (it…
Gavriel
  • 18,088
  • 12
  • 63
  • 98
8
votes
2 answers

Android onConfigurationChanged: how to save and restore fragment back stack?

I have an activity with a dual pane: a list of menu items on the left (fragment M) and details of the currently selected item on the right (fragment D). When the user selects an item in fragment D, fragment D gets replaced with another fragment…
Luke
  • 291
  • 4
  • 10
8
votes
0 answers

Android - TabScreen orientation causes all my screens to be reset?

I currently have a Tab Screen in my Android application, it hosts 4 other activities from its Tabs. I set up each tab as follows: intent = new Intent().setClass(this, LiveActivity.class); spec =…
Donal Rafferty
  • 19,239
  • 37
  • 110
  • 186
8
votes
1 answer

Is there a configChanges for Invert Colors modification

I would like to know if Android has any flag to be added into configChanges in an Activity attribute in the AndroidManifest for modifications in the Invert Colors option of the device. The android doc shows the following flags: - "mcc" - "mnc" -…
Augusto Carmo
  • 3,291
  • 1
  • 16
  • 39
7
votes
2 answers

My views are being reset on orientation change

I have a small activity with an EditText and an imageview and a button. When you press the button it launches camera for result, and when it returns it changes the imageview to the picture you've just taken. But when the orientation changes, the…
7
votes
1 answer

What is called after onConfigurationchanged() method

After screen rotating, the height of one of view object is changed, I want to know the height value in pixel. The onConfigurationChanged method is likely called before view finishing rotation. So if I measure the view size in this method , the size…
user2614801
  • 105
  • 5
1
2 3
10 11