Depends. SessionState sounds like it's a class which extends BaseSavedState (which is used to preserve states of an widget). For example
private static class SavedState extends BaseSavedState { long contactId; public SavedState(Parcel source) { super(source); contactId = source.readLong(); } public SavedState(Parcelable superState) { super(superState); } public void writeToParcel(Parcel dest, int flags) { dest.writeLong(contactId); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator<SavedState>() { public SavedState createFromParcel(Parcel in) { return new SavedState(in); } public SavedState[] newArray(int size) { return new SavedState[size]; } }; } If your SessionState indeed extends BaseSavedState, then you can pass the whole class too. The reason why it would work is, that View.BaseSavedState is extends AbsSavedState which is an implementation of the android.os.Parcelable interface [BasedSavedState] http://developer.android.com/reference/android/view/View.BaseSavedState.html [AbsSavedState] http://developer.android.com/reference/android/view/AbsSavedState.html [android.os.Parcelable interface] http://developer.android.com/reference/android/os/Parcelable.html If you class isn't based on View.BaseSavedState, then you either need to implement the Parcelable Interface to your class or implement Serializable interface in order to pass it as to another activites via Intent/Extras. >From Intent Documentation on putExtra(...) putExtra(String name, Parcelable value) Add extended data to the intent. putExtra(String name, Serializable value) Add extended data to the intent. How ever, depending on the size of your SessionState class, it may be better idea only to pass the necessary data (sounds like sessions used in websites), like cookie data, sessionid and parameters only to recreate the class using this passed data instead of the whole class (for example if there are objects in like Http Classes, sockets and similar). On Feb 24, 7:07 pm, Joseph Arceneaux <joe.arcene...@gmail.com> wrote: > What if I have my own custom class, e.g., "SessionState" that I want to pass > back and forth? > Thanks, > Joe > > On Mon, Feb 23, 2009 at 6:35 AM, Odessa Silverberg < --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---