Android Question Serialize a Bundle

DawningTruth

Active Member
Licensed User
I think this one is a long shot... but here goes...

Is there any way to Serialise a Bundle, or to save a bundle to a file or database. I am trying to save the state of a webview for later use. Any help would be much appreciated :).
 

Computersmith64

Well-Known Member
Licensed User
I think this one is a long shot... but here goes...

Is there any way to Serialise a Bundle, or to save a bundle to a file or database. I am trying to save the state of a webview for later use. Any help would be much appreciated :).
According to a reply I read from Erel in another thread, you cannot serialize views. Possibly one way you could do it would be to save references to the contents of the webview, but I'm guessing that might not be an option.

- Colin.
 

DawningTruth

Active Member
Licensed User
You need to first understand which objects were added to the bundle. Use the debugger to find the bundle keys and values.
Thx Erel,

Ok, I have setup a little project which puts some history into a webview and then saves its state into a bundle. Here is a screenshot from the debugger:



I assume you would want to copy that mArray into a list and then save it to a list and then restore to a new bundle when needed.

The question is:

1. How do you access the mArray?
2. How do you copy to the mArray of the new bundle?

They both look like they are protected variables.
 

DawningTruth

Active Member
Licensed User
Saving it to a list will not help. You need to serialize it to an array of bytes. I don't see how you can do it with this bundle.
Thx Erel, ok I will have to accept this technical limitation and try a slightly less functional workaround. Well at least we tried ;). Thx anyways:).
 
Top