On Mon, Sep 26, 2011 at 2:40 PM, John Goche <johngoch...@googlemail.com>wrote:
> Google "parcelable ClassNotFoundException" for more information. >> >> What I've done is create a "Bundleable" interface that basically does what >> Parcelable is intended to do. Objects extending this interface can put >> themselves and recreate themselves from a Bundle object, which is itself >> Parcelable so you can send it around just like your object - except with the >> minor fact that the system always knows how to load a Bundle type so you >> don't run into this error. >> > > Hmmm... Not sure I follow. Could you please give some more details? > public interface Bundleable { public Bundle toBundle(); public void fromBundle(Bundle b); } public class MyClass implements Bundleable { public Bundle toBundle() { Bundle b = new Bundle(); // Fill b with data return b; } public void from Bundle(Bundle b) { // set properties from data in b } } // ... MyClass m = new MyClass(); Intent i = new Intent(); i.putBundleExtra("MyClass", m.toBundle()); // ... Elsewhere Bundle b = intent.getBundleExtra("MyClass"); MyClass m = new MyClass(b); // Constructor calls fromBundle(b); ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en