android - Close all activities and come to mobile's home screen -


when press log out button , come start(main) screen , when press button main screen comes 2nd screen. but, want close application on click of button main screen , close activities before that. while doing research found,

intent intent = new intent(this, home.class);   intent.setflags(intent.flag_activity_clear_top);   finish(); 

but not satisfying requirement.

you can use code referred here how exit application , show home screen?:

  intent intent = new intent(intent.action_main);     intent.addcategory(intent.category_home);     intent.setflags(intent.flag_activity_new_task);     startactivity(intent); 

although android's design not favor exiting application choice.

related links:

how close android application?

android exit application


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -