Skip to content Skip to sidebar Skip to footer

Starting A Service In An AlertDialog And Have An Outside Activity Bound To It

First of all I've tried searching for this ans was unsuccessful. If my question is out there already answered could someone please point me to it? Thank you very much for either he

Solution 1:

There is a much easier way to do what you want to do that does not require bound services.

First, you should probably extend IntentService instead of Service. This will ensure that your service does not run on the UI thread. You would start the service via an intent the same way you are currently.

Second, in your service implementation, it is much easier to send a broadcast message to indicate that you are done than to try using a BoundService. So in your service you would do something like:

Intent intent = new Intent(); // specify the intent filter appropriately here
sendBroadcast(intent);

Then, in your activity you would want to register a BroadcastReciever that would be notified of these changes. See the BroadcastReceiver doc for more details.


Post a Comment for "Starting A Service In An AlertDialog And Have An Outside Activity Bound To It"