Questions tagged [android-savedstate]

For questions related to Android's onSaveInstanceState and onRestoreInstanceState methods.

197 questions
0
votes
1 answer

ClassNotFoundException upon restoring GoogleMaps object state

My app is crashing consistently when attempting to restore the state of my GoogleMap (mapView) object after returning from an Activity. mapView sits in a custom Support lib v4 Fragment (MyFragment), which itself is embedded in an AppCompatActivity…
0
votes
1 answer

Fragment savedInstanceState not working

I have several fragments here and there's this one fragment where I want to save its state when I get back to it. I tried doing it in a testfragment where, when I click the button, the textview text will change to "test1"(The default text of the…
0
votes
2 answers

How to save a custom View's state in a RecyclerView in a dynamically added fragment?

TL;DR : I cannot differentiate the RecyclerView's call to onBindViewHolder when it is recycling a View or replacing the Fragment. I did spend a lot of time looking for answers here on SO, but nothing worked in the end. What it did do is teach me the…
0
votes
1 answer

Save Instance in Android Fragment

I have a Fragment called HomeFragment.java. This is the first fragment that is launched when my app is opened. Inside this fragment, I have a method called "onAsyncTaskDoInBackground" that gets all the data from the server using JSON. What i am…
Quicky App
  • 123
  • 2
  • 14
0
votes
1 answer

Values inside savedInstanceState are nulls or default values

I have a fragment and an Activity, the activity code look like this: public class ActivityA extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override public void onSaveInstanceState(Bundle…
RdlP
  • 1,366
  • 5
  • 25
  • 45
0
votes
2 answers

Error on doing a background task after returning from child task

I'm not sure I fully understand what needs to be done to retrieve data after returning from a child activity. I don't need to pass data to the parent activity. I used this for reference, they do mention onPause and onResume as well as possible…
RGM-79FP GM Striker
  • 155
  • 1
  • 1
  • 14
0
votes
1 answer

How to save loaded listView state in fragment?

I have one activity, fragment with listView and fragment with details for each listView item. I am getting fragments data from API. How should I save loaded date and listView position correctly to be able to restore it when I am returning back to…
user1835337
  • 656
  • 1
  • 9
  • 32
0
votes
1 answer

Best way to start/maintain activity?

I'm trying to redesign my android app, but I'm not sure what the best programming method is for what I'm trying to do. Currently, I have a page in my navigation drawer called "My Workout". In this page I have an expandable list view, and each item…
0
votes
1 answer

Saving RecyclerView/Notes for Later Use

I'm trying to re-design my app, but I'm not sure the best way to go about it. I currently have an expandable list view with some workouts as the headers/parent items. Each workout has 4 child items, representing 4 weeks. When the user clicks a week,…
LBJ33
  • 425
  • 11
  • 29
0
votes
1 answer

Fragment recreation on back from another activity

I have two activities, A and B. Activity A, has one fragment F, added dynamically via a transaction. From F, I start activity B (F.getActivity.startActivity(intent)). When I press the back button, F gets recreated. Can I avoid that? If not, I…
Jason Oviedo
  • 459
  • 1
  • 5
  • 16
0
votes
2 answers

Save state of StreetViewFragment when orientation changes

I am trying to save the current position of the StreetViewPanorama in the StreetViewFragment so for example if the user is originally in Portrait and changes the location in the StreetViewPanorama by tapping on the arrows and explore the area and…
Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
0
votes
3 answers

Can't save fragment state in Android while configuration is changed

This type of question is asked many times in SO, I have tried all of them, but couldn't achieve what I actually want. In my app I have Fragment, inside that fragment I have a recycler view. recyclerview would be manipulated by the data which I have…
0
votes
1 answer

Can not perform this action after onSaveInstanceState

The following is my stack trace : Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493) at…
0
votes
1 answer

Custom preference isPersistent()

I wrote my own number picker preference using android's brief guide and some googling. My question is regarding the onSaveInstanceState() method. On google's tutorial, it is suggested that we use the method isPersistent() to determine if the…
0
votes
1 answer

Make uploaded image remain after layout/Activity change

I am still a rookie in terms of java and android programming, I believe I have come far in the last weeks but now I'm a little bit stuck and I would really appreciate your help. I am trying to develop an app that can create a User profile Layout.…