On Fri, Nov 26, 2010 at 3:31 AM, pedr0 <pulsarpie...@gmail.com> wrote:
> Hi TreKing, could you explain the 3rd way, I have to send to another > application an ArrayList<CustomObject>, how to do it? > Well, as Mark has explained, trying to send some CustomObject to another app doesn't sound like the most stable idea, if it works at all. On Fri, Nov 26, 2010 at 6:40 AM, Federico Paolinelli <fedep...@gmail.com>wrote: > I am interested in this approach too. Do you mean having a sort of > toBundle() method and a constructor that accept a Bundle, or is there > something more slick? > That's the gist of it. I have an interface with two methods: Bundle toBundle(); and void fromBundle(Bundle bundle); Each derived class also defined a constructor that just calls fromBundle(). It's basically the exact same idea of the Parcelable interface where you shove your data into a Bundle and then read it back in some structured fashion. I switched to this strategy after running into some class loader problems trying to instantiate my Parcelables in a Service that had been passed from an Activity. There's at least one post in the group describing the problem. This fixed that problem and simplified things considerably by removing the need to copy and paste the CREATOR stuff and the (apparently pointless) describeContents() function. If you're already using Parcelable, it's pretty easy to switch to this method. ------------------------------------------------------------------------------------------------- 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