Questions tagged [instancestate]

19 questions
9
votes
2 answers

Is the Android activity instanceState cleaned during app upgrade?

In the instanceState of an activity we store a Serializable (bundle.putSerializable). In a crash report from the Play Store we saw the following stack trace: Caused by: java.lang.ClassNotFoundException: o.ণ at…
userM1433372
  • 5,345
  • 35
  • 38
3
votes
1 answer

IllegalStateException: Can not perform this action after onSaveInstanceState - Android

I am trying to figure out why my android app crashes sometimes, with the above exception. I can't find the source of the problem from what the logcat says. It happens rarely. Logcat output: java.lang.IllegalStateException: Can not perform this…
Edmond Tamas
  • 3,148
  • 9
  • 44
  • 89
3
votes
1 answer

Overriding onSaveInstanceState

I'm trying to come to grips with the onSaveInstanceState method in class View (not the one in class Activity). That method does return a Parcelable. I derived my own View from ViewGroup and overrode that method to save my own state. But when the…
MvG
  • 57,380
  • 22
  • 148
  • 276
2
votes
2 answers

How to save HashMap to file?

Sorry for my poor English. I have a HashMap to save some InstanceStates of a RecyclerView,and I want to save the HashMap into a file. I use the ObjectOutputStream,it can write into a file,but when I use…
DawnYu
  • 2,278
  • 1
  • 12
  • 14
1
vote
2 answers

How to Refresh App with onConfigChanges without loosing instance

protected void onResume() { super.onResume(); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); Configuration config = getBaseContext().getResources().getConfiguration(); …
Abhishek T.
  • 1,133
  • 1
  • 17
  • 33
1
vote
0 answers

How to serialize list of custom objects for instance state in Xamarin for Android?

I've got a generic list as data source for my activity. Now I want to save this list in instance state. In native Android applications this can be done very easily - I just let my custom model implement Serializable - as the generic ArrayList…
Martin H.
  • 1,086
  • 1
  • 17
  • 28
1
vote
1 answer

How to save instance state on Custom View in Android?

I have a a custom View that extends LinearLayout : public class CustomEditTextLogin extends LinearLayout { public CustomEditTextLogin(Context context) { super(context); // TODO Auto-generated constructor stub …
Hossein Kurd
  • 3,184
  • 3
  • 41
  • 71
1
vote
2 answers

Maintaining fragments instance state between transactions

From all the searches I have found on SO stating that you should save your instance state in the @Override public void onSaveInstanceState(Bundle outState) However This is tightly coupled with the activities lifestyle. How can I save the state of my…
Zapnologica
  • 22,170
  • 44
  • 158
  • 253
1
vote
3 answers

NullPointer Exception Saving Intent string as Instance State Android

I´ve got a little saveInstanceState problem. One activity sends via intent a string value to another activity, which works fantastic. Now at the second activity I select one row item to get to a third activity, which works also. But if I use the…
ben
  • 161
  • 3
  • 18
1
vote
2 answers

How to get current EC2 instance state in Java

I'm looking for some code that will return the current instance state regardless of whether the instance is currently running or not. I found some code that will return the desired result on a running instance, but when trying to find one that will…
DGolberg
  • 2,109
  • 4
  • 23
  • 31
0
votes
1 answer

Espresso tests cause "ClassNotFoundException when unmarshalling" (REPRODUCED on basic app)

It seems that this unmarshalling exception always gets thrown when an activity is recreated with saved instance state during espresso tests. I have reproduced it with a very basic android app. Here are the steps: Create an android app with two…
0
votes
1 answer

How to prevent activity re-starting with previous InstanceState data

I have an activity that is opened from my main activity. When it is closed using the back button and then restarted it is opening using the previous instancestate instead of opening as if it was new. The Main activity public void…
Dan
  • 15
  • 3
0
votes
1 answer

Android - Animate views from Activity A in Activity B when minimum SDK is 16

Making a project I am faced with the following problem. I have to perform some animations on views that belong to Activity A while at the same time perform animations that belong to Activity B. Minimum SDK is 16 so I cannot use the Shared Elements…
Anonymous
  • 4,470
  • 3
  • 36
  • 67
0
votes
0 answers

Saving booleans to bundles for later use in Android

When I try to save a boolean to a Bundle, it appears to save (from Print Outs), but then the system does not invoke the onRestoreInstanceState method during the process of recreation after returning from visiting the settings page of the app. (The…
0
votes
1 answer

Using onSaveInstanceState to prevent network call a second time

In my OnCreate method I am making a network call and populating a listview with the results. I am saving the result in an ArrayList and using the ArrayList to populate the listview. If the user presses the back button and reenters the activity I…
Andrew
  • 83
  • 7
1
2