In my projects I am using BroadcastReceiver
s as a callback from a long running thread (eg. notify the activity that a download was finished and send some response d
I'll just add another option to the other great answers you've received already...
You don't have to create a broadcast receiver to receive Intents. In your android manifest file you can register any activity to receive intents:
....
Then override the onNewIntent(Intent)
method in your activity to receive it.
To send the Intent, use the Context.startActivity(Intent)
method. Most likely you'll want to add the FLAG_ACTIVITY_SINGLE_TOP
flag to your Intent so it doesn't create a new instance of your activity if one is already running.
EDIT: I just noticed you are running within a single application. Therefore, a simple callback is probably best. The solution above does work in a single app, but is more appropriate for different applications. I'll leave this here just in case it helps someone. Good luck!