For questions related to Android's onSaveInstanceState and onRestoreInstanceState methods.
Questions tagged [android-savedstate]
197 questions
0
votes
1 answer
Error in onSaveInstanceState method
For one of the user(motorola motorola XT1068) i am getting exception for onSaveInstanceState. I am using ACRA for crash report.
Here is the complete stack trace:
java.lang.IllegalStateException: Can not perform this action after…

Madhukar Hebbar
- 3,113
- 5
- 41
- 69
0
votes
3 answers
Android: Attempt to invoke virtual method a null object reference
I have some problem. Here in my code I am trying to redraw drawing drawn on board on screen rotation. but I am getting Null Object Reference exception
In my code bitmaps is an Bitmap arraylist.
Here's my saveInstanceState code
@Override
protected…

Jishnu Mk
- 143
- 1
- 3
- 12
0
votes
2 answers
Google maps v2 prevent map reloading on rotation
I'm displaying a GoogleMap in my Fragment. When I rotate the screen the map gets reloaded. In the GoogleMaps app the map does not get reloaded(Map disappears, grey screen and appears again)
My code:
@Override
public View onCreateView(LayoutInflater…

Robin Dijkhof
- 18,665
- 11
- 65
- 116
0
votes
0 answers
Fragment saves instance state, but never reloads it
I am having trouble reloading my fragments state.
The architecture is like this:
I am having an Activity A with a Fragment F. With the options menu Activity A opens the SettingsActivity with its SettingsFragment (with startActivity()). During this…

Martin Mlostek
- 2,755
- 1
- 28
- 57
0
votes
0 answers
android unfortunately stopped after resuming activity for a long time
I am creating a simple application. while using my application, when i click home and go to another app and work for some time like 10 to 15 minutes.
When i get back to my app, its will show "unfortunately app stopped" message. And then app closes…

harikrishnan
- 1,985
- 4
- 32
- 63
0
votes
1 answer
Savedinstance class not found on orientation change
I'm trying to compensate for my list items when the screen orientation changes by using the savedInstance and Bundle but I keep getting multiple java.lang.ClassNotFoundException errors. When I step through the code it appears to add the item into…

snapplex
- 851
- 3
- 13
- 27
0
votes
1 answer
Android ListView Save Instance
How do I save instance of my listview in the following example? Please help me out. I don't know where and how to add the onSaveInstance method and how do I call it.
public class Shows1 extends Activity {
ArrayList actorsList;
String…

Elvi T
- 11
- 2
0
votes
1 answer
Data saving when orientation changes
I have put a condition in onCreate() method to check if there exist some previous data or not. But it is not working.
please guide me.
And I don't want to use onRestoreSavedState() method for this.d
public class ActivityOne extends Activity {
Use…

Rohan Chauhan
- 39
- 5
0
votes
1 answer
Saving data in fragment android
I have been trying to achieve a certain functionality related to contacts.I have a fragment that shows all the contacts in the device.At first when fragment instance created the contacts will be fetched and stored on a arraylist which will then be…

AndroidMech
- 1,676
- 3
- 20
- 31
0
votes
2 answers
Activity's savedInstanceState() not being called when going to new Activity via ActionBar
Any Help would be appreciated because I am almost finished and this one little thing is bugging me so much!
I have 1 of three activities that in onCreate() it populates a TextView from a query of a database. This activity is also the main activity.…

KellysOnTop23
- 1,325
- 2
- 15
- 34
0
votes
1 answer
Persistent booleans Android Studio
I've been poking around the web (including SO), and have found lots of information on having persistent data. I've found strings, ints, doubles, calendars, just about everything. The ones I haven't seen a specific guide or tutorial for are…

Nathan Lundgren
- 79
- 3
- 14
0
votes
1 answer
App not restoring bundle after returning from another activity
I have an app that uses google maps. I am saving the latLngBounds to variables and then to bundle to later retrieve it. My problem is that I want to save the current position of the screen and then move the camera to that LatLng. But each time when…

Lookie
- 73
- 9
0
votes
1 answer
Fragments within a Fragment cannot retain their values
I have an activity and in that activity I have 2 Fragments A and B.
Fragment A has a EditText for entering Email.
Fragment B contains 2 more fragments B1 and B2 which can be selected using two buttons at the bottom of Fragment B.
B1 and B2 contain…

Kazmi
- 593
- 1
- 6
- 24
-1
votes
1 answer
How save the state of the item on my fragment?
I'm getting a ArrayList from an Url with AsyncTask, and inserting into an ListView on my Fragmentbut everytime I change fragments I have to get json data from the Url again so I tried to use onSaveInstanceState() to save my ArrayList as a String and…

Bruno Monteiro de Andrade
- 53
- 1
- 7
-1
votes
1 answer
Saved State getting nullified
I am trying to fetch details from savedInstanceStatethat were saved in a newInstace() and needs to be fetched in onCreateView().
The problem:-
When I try to fetch the details, It throws an excpetion.
java.lang.NullPointerException: Attempt to…

Abhiroj Panwar
- 17
- 3