android - Forcing my activity to foreground? -


i have launcher style app. once user launches app, clock starts ticking , after amount of time, user brought main activity of app , informed time up.

to achieve this, have asynctask doinbackground regularly checks how time has elapsed (this part works fine). then:

    protected void onpostexecute(string s) {         super.onpostexecute(s);         intent intent = new intent(getapplicationcontext(), homescreenmain.class);         intent.addflags(intent.flag_activity_reorder_to_front);         startactivity(intent);     } 

the problem keeps app in background, although assume proper activity launched. question is, how, when time has expired, can not start activity bring foreground on top of app user may have launched within app?

replacing original code following:

protected void onpostexecute(string s) {     super.onpostexecute(s);     intent intent = new intent();     intent.setclass(homescreenmain.this, homescreenmain.class);     intent.addflags(intent.flag_activity_new_task);     getapplicationcontext().startactivity(intent); } 

did trick.


Comments