java - How to open not main activity when restart my application in android -


i made app worked in background using background service when user clicked specific button (start button) , user can stop application task restart application , open again .. user can stop app clicking on stop button.

i use code snippet let app close ui , return home screen , before set start button on disable mode ...

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

unfortunately, when open app again start main activity not contains start button , stop button , when swipe second activity contains buttons find start button enabled i.e. previous task of background service lost ??!!

could 1 provide me solution.

every time open app buttons enabled default(excepting disabled start).

so need saved state retain it's state. here how retain , restore state.


Comments