Bring the app to foreground and if it is already running rather than creating new instance of it in android -


in app want launch apps(messaging,contacts,etc)if launched app(messaging,contacts,etc) running in background want bring front.i tried using movetasktofront() doesn't implement above api 23(lollipop).so,i ended code:

intent intent=getpackagemanager().getlaunchintentforpackage("com.android.mms");         intent.setflags(intent.flag_activity_new_task);         startactivity(intent); 

by using code if launch messaging inside app launches,and if again launches same app inside app resumes , continue left it. when launches same messaging app default android launcher create new instance of messaging app on above of running messaging app launched app. don't know solution this.please me ...

use below approach invoke intents within app this.

intent intent = new intent(context, target_activity.class); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top | intent.flag_activity_new_task); startactivity(intent); 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -