Pass in the Activity object and hold it in a WeakReference in the thread class.
Using a WeakReference means that you will not leak memory if your Activity is destroyed before your thread completes and also if you find that the WeakReference is null you know that the Activity has "gone away". On Friday, September 7, 2012 5:18:46 PM UTC+1, bob wrote: > > What do you normally do on Android when you spawn a thread but the thread > needs to access > > your Activity object? Do you typically pass the Activity object to your > own constructor for the Thread? > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

