Questions tagged [onsaveinstancestate]

230 questions
0
votes
1 answer

After rotating device data is not getting loaded which was stored in onSaveInstanceState callback

Loading the data through a network call and when the device rotates then the data stored in onSaveInstanceState callback,the adapter is notified of the change but the activity becomes blank after rotation. A code snippet given below: protected…
0
votes
2 answers

How to store nested Arraylists in a Bundle in Android

I have this object in my Android App source code: ArrayList> rsp and i want to store it in a Bundle and use it in OnSaveInstanceState() method in my activity. Then i want to retrieve it from the bundle, too. Should i use json?…
mike_x_
  • 1,900
  • 3
  • 35
  • 69
0
votes
1 answer

Android - ImageButton Loses Pressed State When Notification Drawer is Pulled Down

I am losing the pressed state of my ImageButton when the notification drawer is dragged down form the top. I'm not sure why this is happening? I'm currently using onSaveInstanceState and onRestoreInstanceState to ensure that the ImageButtons state…
0
votes
1 answer

Save and restore TableLayout on orientation change

In my program I, have a TableLayout with one TableRow where I added more TableRows with 4 TextViews in it dynamically on a Button Click. Now I want to save and restore this table if I change the orientation of my phone. I have following code which…
0
votes
2 answers

Why does my savedInstanceState Bundle not preserve values?

I am making a fitness app that allows users to make lists of fitness events. One of the options when making a new event is to select the location using a Google Map. This opens a new fragment, and causes all values on the current fragment to be…
jtmaher2
  • 482
  • 5
  • 19
0
votes
3 answers

Android: Activity onCreate savedInstanceState allways is null

So, I know is question is duplicated, but I didn't find solution in these answers. I have a MainActivity and GameDetailActivity. MainActivity hierarchical parent of GameDetailActivity. Here it is declarations in manifest file:
SBotirov
  • 13,872
  • 7
  • 59
  • 81
0
votes
0 answers

Empty Bundle in the onSaveInstanceState method

I display pictures from moviesdb using volley in a gridview. The next step is have that gridview in the landscape mode too. So my logic behind this,is to store the list that contains the data as key value pair inside the onSaveInstantState method…
Theo
  • 3,099
  • 12
  • 53
  • 94
0
votes
1 answer

Android - Save instance state in Application instance (TransactionTooLargeException )

Android 7.0 start throwing TransactionTooLargeException while restoring instance state if the parcel size is over the limit. But my application have to save the loaded content which has no size limit. So it's very easy to cause this error. Is it…
0
votes
2 answers

Is it possible to save activity state when calling finish() in Android?

I use startActivityForResult to switch from my first activity to second activity. In second activity there's number of checkboxes for user to choose. I get the result from second activity and call finish(). But if the user changes his mind and opens…
mamzi
  • 495
  • 5
  • 11
-1
votes
2 answers

Saving ImageView background state

I have an ImageView ImageView1, whose background can be set by the user. How can I save the state of that background, so that when the user closes the app and reopens it, the background of ImageView1 is still the same? Is it possible with…
gi pi
  • 103
  • 1
  • 8
-1
votes
1 answer

How to pass data from onCreate() to onSaveInstanceState()?

I have an onCreate() function and an onSaveInstanceState() function in my Main Activity. I have declared a Map in my onCreate() and I want to access the keys of that Map in my onSaveInstanceState() function, so as to save them to the outState…
-1
votes
1 answer

How to put serialize and get serializeContext in Kotlin Android?

I want save and keep my state in fragment because when tap on recyclerView items and back to fragment with listener i lost my Context and my context in fragment is null. So i try to keep my context like this: override fun…
-1
votes
2 answers

Send ArrayList between Bundle

Problem: How do I transfer the data of _selectednumber and _points from onSaveInstanceState to onRestoreInstanceState? private List _selectednumber= new ArrayList<>(); private List _points = new ArrayList<>(); private int _hit=…
HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
-1
votes
1 answer

My app keeps crashing after overriding onSaveInstanceState

I have a piece of code that is meant to help me understand how to override the onSaveInstanceState method in order to preserve some data in case the device is rotated. The code is very simple and does nothing interesting: there's two buttons, when…
JohnnyJohnny
  • 181
  • 1
  • 12
-1
votes
3 answers

Whenever i rotate the screen it jumps to main activity screen from fragment screen

I am beginner in android,I created application with fragment.In which when i rotate the screen(when in fragment screen) it leaves that fragment screen and jumps to main activity screen.Why?Please help me to solve this. My Main…
1 2 3
15
16