For questions related to Android's onSaveInstanceState and onRestoreInstanceState methods.
Questions tagged [android-savedstate]
197 questions
0
votes
2 answers
Data from savedInstanceState is always empty in Android
I am developing an Android app. I am testing using onSaveInstanceState event in activity. But it is not working as I expected, because value string is always empty when I retrieve it back onCreate event.
This is my activity
@Override
public void…

Wai Yan Hein
- 13,651
- 35
- 180
- 372
0
votes
2 answers
Save Instance State of GPS and enabled buttons
My problem is that when i rotate the GPS, then I can't stop the LocationServices.FusedLocationApi. This only happens after I have rotated the screen. If I dont change the orientation the start and stop works fine.
This should controll if it should…

Rasmus Rajje Josefsson
- 1,564
- 2
- 15
- 33
0
votes
2 answers
Retain fragment in viewpager after rotating
Edit: I'm terrible at explaining these things so here is a video
http://sendvid.com/mefqxd8f
Context:
The application consists of a single Activity with a ViewPager that holds 3 tabs. Tab1 uses an interface called PageFragmentListener to switch…

Luke Allison
- 3,118
- 3
- 24
- 40
0
votes
1 answer
savedInstanceState bundle contains unknown key
On screen rotation, I want to restore data. So I am using onSaveInstanceState method to achieve that. Whenever I restore the bundle in onCreate and print it in Logcat. I am getting additional these two strings as key:
In onCreate:
…

sandesh
- 390
- 6
- 20
0
votes
1 answer
How to save and restore NetworkImageView and Textview on configuration change
I am fetching data from the web using volley and displaying the result in TextViews and an NetworkImageView.
I have succeeded in saving and restoring the states of the textviews but I ran into a problem with the NetworkImageView.
FruitDetails
public…

X09
- 3,827
- 10
- 47
- 92
0
votes
1 answer
Android - Saving state of Viewpager inside a fragment
I have a container fragment Acadmey which is containing a viewpager and viewpager consist of different child fragments. In the child fragments of View pager I invoke the json request to get the data to be populated. For the first time every thing…

GeekWithGlasses
- 572
- 2
- 12
- 30
0
votes
1 answer
Restoring Temporarily Data (Textviews) on a ReclyclerView with CardView (Data loss due changing Activities)
My layout has a ViewPager with 3 Fragment.
In the fragments, I've got a recyclerView populated from some arrayList and Maps. The output uses CardView with several buttons, and TextViews with dinamic data (buttons change the TextView…

Raul Lopez
- 68
- 4
0
votes
2 answers
How to save state with navigation drawer and fragments
I have an application with a navigation drawer, one activity and many fragments. When I change the device orientation my main activity is recreate and it's my main fragment who appears, not the current fragment. Just like when I launch the app.
How…

Jhiertz
- 90
- 6
0
votes
0 answers
Edit text in fragment gets reset after setText()
I'm saving the content of my EditText on rotation as
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("editTextText",mEdittext.getText().toString());
}
And in my…

San Dé
- 43
- 1
- 6
0
votes
1 answer
Can't save state of RelativeLayout
I am making an application which has an activity where the user can add a picture to an object, here I give the user the choice between selecting a picture from the gallery or making a new one using the camera. Both of these options start an Intent…

Dennis van Opstal
- 1,294
- 1
- 22
- 44
0
votes
1 answer
Saving and restoring an ArrayDeque onSaveInstanceState
I am working on an video app thats uses an ArrayDeque to store our history of videos viewed, using push, pop. It works well but I'm looking for a clean way of saving and restoring the ArrayDeque
private Deque mVideoHistory = new…

Eoin
- 4,050
- 2
- 33
- 43
0
votes
1 answer
How Can I Store Objects from LinearLayour when the Activity is destroyed?
I have a activity that merely holds up a fragment, and this fragment has 2 objects that inherits from LinearLayout. I had a problem to manage the screen rotation, but i solved it up restoring and saving the state of these objects on their own…

Myrium
- 205
- 3
- 11
0
votes
1 answer
Android OutOfMemory error in Fragment onSaveInstanceState
I have a Fragment with RecyclerView, which holds items with ImageView (basically like gallery app). Images are displayed using async task to do the work in separate thread. Images are displayed from base64 encoded string. Images are also cached with…

Arūnas Bedžinskas
- 710
- 9
- 22
0
votes
2 answers
How to create a ratings/review alertdialog box and save what was selected?
I have created an alertdialog box that shows up when the user first clicks on my app, what I want to know is how to direct the app to my app in the Play Store and save what was selected so that the box does not show up again. Please help,…

nosh
- 620
- 3
- 14
- 50
0
votes
1 answer
Save landscape application state while device will unlocked from lock state
My application has only landscaped mode. And there are some edit text fields on the screen. I am filling some contents in edittext box and lock the device and When i unlock the device and i found the my application screen with blank edit text box.…
user4570857