You are correct in that if Android kills your process you will lose
the static variable.

As to your question "is serializing the class and *then packing
the serialized result into the bundle* the correct thing to do when using
serialization?", I would say it depends on how big (i.e how many
bytes) your complex class is.  Instance state isn't necessary the best
for large binary chunks of date (i.e. big bitmap values). I'm not to
sure what Android would consider "large" however.

Some possible alternatives:

* Although deprecated in API 13, you can use
onRetainNonConfigurationInstance/getLastNonConfigurationInstance to
save your object ( some info here:
http://developer.android.com/guide/topics/resources/runtime-changes.html).

* Maybe you could write the byte array to internal storage, and store
the path to the file in instance state (much smaller), and and then
deserialize it yourself when your activity is created

On Mon, Feb 4, 2013 at 9:59 PM, craig <[email protected]> wrote:
> I considered a static variable.
>
> If Android kills my process then the static variable would be gone but the
> serialized variable would be retained right?  That's the only reason I'm
> leaning towards serialized.
>
> I guess to clarify my question, is serializing the class and *then packing
> the serialized result into the bundle* the correct thing to do when using
> serialization?
>
>
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/Serializing-State-of-Complex-Class-tp5712833p5712835.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid



-- 
http://www.opgenorth.net
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to