Android :: how to quit complete application, on dialog box button click -


i using below code quit application.

case if internet not available shows dialog box saying internet not available , press ok. once user press ok close app still app shows in recent apps list.

below code ::

 alertdialog.builder builder1 = new alertdialog.builder(context);         builder1.settitle("oops! internet not available.");         builder1.setmessage("connect internet , restart app.");         builder1.setcancelable(true);         builder1.setpositivebutton("ok",                 new dialoginterface.onclicklistener() {             public void onclick(dialoginterface dialog, int id) {                 intent intent = new intent(intent.action_main);               intent.addcategory( intent.category_home );             intent.setflags(intent.flag_activity_clear_top);             intent.addflags(intent.flag_activity_new_task);           intent.addflags(intent.flag_activity_exclude_from_recents);         startactivity(intent);              }         });          alertdialog alert11 = builder1.create();         alert11.show(); 

after using above code, still shows in recent app list.

i have tried below things.

system.exit(0);

finish();

intent.addflags(intent.flag_activity_exclude_from_recents);

please tell me how can remove app recent app list.

i guess there number of ways remove recent app history list.

via activity manger:

activitymanager = (activitymanager)getsystemservice(context.activity_service);   if(am != null) {      list<activitymanager.apptask> tasks = am.getapptasks();      if (tasks != null) {          tasks.get(0).finishandremovetask();      }   } 

via manifesto.xml

<activity android:name=".activity2" android:excludefromrecents="true"></activity> 

or via intent

intent intent = new intent(main.this, newactivity.class);  intent.setflags(intent.flag_activity_clear_top); intent.addflags(intent.flag_activity_exclude_from_recents); startactivity(intent); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -