Any idea regarding update seekbar progress from service in android. i was trying but cant update progress of seekbar.
please help me out.
thank you in advance.
Any idea regarding update seekbar progress from service in android. i was trying but cant update progress of seekbar.
please help me out.
thank you in advance.
I have a simple idea to do this if you want
Using a Messenger is another simple way to communicate between a Service and an Activity.
In the Activity, create a Handler with a corresponding Messenger. This will handle messages from your Service.
class ResponseHandler extends Handler {
@Override public void handleMessage(Message message) {
Toast.makeText(this, "message from service",
Toast.LENGTH_SHORT).show();
}
}
Messenger messenger = new Messenger(new ResponseHandler());
The Messenger can be passed to the service by attaching it to a Message:
Message message = Message.obtain(null, MyService.ADD_RESPONSE_HANDLER);
message.replyTo = messenger;
try {
myService.send(message);
catch (RemoteException e) {
e.printStackTrace();
}
A full example can be found in the API demos: MessengerService and MessengerServiceActivity link. Refer to the full example for how MyService works.