Intent goMain = new Intent(getBaseContext(),MainActivity.class);
goMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
goMain.putExtras(extras);
getApplicationContext().startActivity(goMain);
What I'm trying to do is, sending data from a separate IntentService
o one and only MainActivity
. What happens and which i would not prefer it to happen is bringing a new activity instead of the current running one. And additionally, the current running activity does not show the data sent from the intentservice. When I try removing FLAG_ACTIVITY_NEW_TASK
I get "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK
flag" error. Can anyone help me with this?
Thanks in advance.