My application has options that can only be applied correctly after restarting the application, so I restart my application as follows:
PendingIntent intent = PendingIntent.getActivity(getActivity(), 0,
new Intent(getActivity().getIntent()), 0);
AlarmManager mgr = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, intent);
System.exit(1);
All actions will be restored. However, all added fragments are lost. How to restore all fragments so that after restarting the application the user sees the same place?
source
share