Basically, i have an activity that has a progress dialog, i'm sending a message to an Intent to load all the data from the internet without any hiccup in the application. However, i was able to send a message to the service but i wasn't able to resend the message to the activity. What to do?
Here's how i send message to the service:
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
}
};
final Intent intent = new Intent(this, FillingDatabase.class);
final Messenger messenger = new Messenger(handler);
intent.putExtra("messenger", messenger);
startService(intent);
And here's how i recieve the message from the service:
messenger = (Messenger) intent.getParcelableExtra("messenger");
message = Message.obtain(null, 1234);
messenger.send(message);
But i wasnt able to know how to recieve that message in an activity, can someone explain the approach? Thank you!