Re: [android-developers] Best practice to pass persistent objects from an activity to another activity
The best way is to use Parcelable. If you have one or two variables to pass around you can use XTRAS mechanism. But if you have an object with 5-10 member fields, using Parcelable makes it elegant and clean. Yes you can use static member to pass data around but this will most often cause memory leak if you are not careful or don't know how to handle the dangling references. On Sun, Jul 4, 2010 at 5:34 AM, Thomas Frick frick...@gmail.com wrote: Dear All, I have two activities. Activity A creates an object and stores some data in this object. After that, activity B ist started. In activity B I have to use the object created in activity A. What is the best way to pass the object from activity A to B? I think it is not possible to store an object in the SharedPreferences, isn't it? Is it a good way to call the object in activity A directly from activity B? Thanks for your help. Thomas -- 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 -- 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
Re: [android-developers] Best practice to pass persistent objects from an activity to another activity
It depends very much on the object you want to pass and how its going to be used. I've used a number of different techniques in my applications, and each one is best suited to different situations. -- Tom Gibara email: m...@tomgibara.com web: http://www.tomgibara.com blog: http://blog.tomgibara.com twitter: tomgibara On 4 July 2010 13:34, Thomas Frick frick...@gmail.com wrote: Dear All, I have two activities. Activity A creates an object and stores some data in this object. After that, activity B ist started. In activity B I have to use the object created in activity A. What is the best way to pass the object from activity A to B? I think it is not possible to store an object in the SharedPreferences, isn't it? Is it a good way to call the object in activity A directly from activity B? Thanks for your help. Thomas -- 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.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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
[android-developers] Best practice to pass persistent objects from an activity to another activity
Dear All, I have two activities. Activity A creates an object and stores some data in this object. After that, activity B ist started. In activity B I have to use the object created in activity A. What is the best way to pass the object from activity A to B? I think it is not possible to store an object in the SharedPreferences, isn't it? Is it a good way to call the object in activity A directly from activity B? Thanks for your help. Thomas -- 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