How to pass String
From IntentService
To Activity
.
MyService.java
protected void onHandleIntent(Intent intent) {
String abc ="XYZ"; // pass this string to Activity class
}
Activity is same which is calling Service class.
How to pass String
From IntentService
To Activity
.
MyService.java
protected void onHandleIntent(Intent intent) {
String abc ="XYZ"; // pass this string to Activity class
}
Activity is same which is calling Service class.
just simply goto inside onHandleIntent method and do some staffs like the code bellow
protected void onHandleIntent(Intent intent){
String abc ="XYZ"; // pass this string to Activity class
// Open a new activity called in my case Activity1
Intent intent = new Intent(this, Activity1.class);
// Pass data to the new activity
intent.putExtra("message", abc);
//then finally start the activity
startActivity(intent);
}
Use ResultReceiver class to send data from IntentService to Activity. Please refer this link. How to get results from an IntentService back into an Activity?