I’m having trouble with http://developer.android.com/resources/articles/painless-threading.html It’s been touted as a great source of information on painless threading, but I’m still having trouble even after reading basic documentation on Activities.
Here’s my problem: I am using Eclipse to modify some Android source code that already creates a thread and handler that runs in the background even when I switch to a new activity. What I want is to implement a way for this background thread to provide data to new activities. I’ve looked at .aidl and AsyncTask solutions without success.
Any ideas anyone?
Thanks!
If your activities are in the same package/app, you could put a reference to the thread in the Application object so that it can be accessed from all of your Activities. You would need to create a custom Application subclass and reference it in your manifest.
If you are looking at activities from different packages you could use a broadcast receiver model or a bound service I guess.