Starting an Activity with Toast from IntentService
package in.co.wizardinfosolutions.batch270705; import android.app.IntentService; import android.content.Intent; import android.content.Context; import android.os.Looper; import android.os.Handler; import android.support.annotation. Nullable ; import android.widget.Toast; /** * An { @link IntentService} subclass for handling asynchronous task requests in * a service on a separate handler thread. * <p> * TODO: Customize class - update intent actions, extra parameters and static * helper methods. */ public class MyIntentService extends IntentService { public MyIntentService() { super ( "MyIntentService" ); } @Override protected void onHandleIntent( @Nullable Intent intent) { try {Thread. sleep ( 3000 );} catch (Exception ex){} showToast( "Starting Main Activity" ); Intent ma = new Intent(getBaseContext(), MainActivity. class ); ma.addFlags(Intent. FLAG_ACTIVITY_NEW_TASK ); ...