I've faced with one problem - clearing activity history. I have the following consequence where my problem appears:
A(SplashScreen)->B(GuestScreen)->C(Screen for signed users)->Press Home Button->A->B->Press Back Button->C->Press Back BUtton->B->Press Back Button->exit from the app.
I tried different ways to solve it and found only one quite strange solution throughout setting almost all activities to singleInstance and setting all intent flags to CLEAR_TOP and NEW_TASK
but all activities are presenting some strange(not as normally, I mean, firstly, there appears empty black screen with actionBar and after ~1 second appears my real layout) and with a bit delay as I already said. I didn't like this solution in spite of that everything closes correctly and in correct consequences. Now, I'm trying to get it work normally without this delay and strange black screen on a moment. I tried to play with intent flags like CLEAR_TASK, CLEAR_TOP
too. Tried to use clearTaskOnLaunh for root activity and finishOnLaunch in manifest file
for others where it`s necessary, doesn't help. How to fix it?
EDIT:
Trying set clearTaskOnLaunch to A again. I see next log when start app first time(A has already called B without any flags):
Main stack:
TaskRecord{42610648 #869 A }
Intent { flg=0x10000000 cmp=/.activities.SplashActivity }
Hist #4: ActivityRecord{413cf8f8 /.activities.GuestActivity}
Intent { cmp=/.activities.GuestActivity }
ProcessRecord{414fdf60 15651:/10103}
// Guest Activity(B) calls UserActivity(C):
Intent { flg=0x10000000 cmp=/.activities.SplashActivity }
Hist #3: ActivityRecord{415c86f0 /.activities.UserActivity}
Intent { cmp=/.activities.UserActivity }
ProcessRecord{414fdf60 15651:/10103}
//Press Home Button and launch app again(A has called B):
TaskRecord{42610648 #869 A cashongo.app.peachy}
Intent { flg=0x10000000 cmp=c/.activities.SplashActivity }
Hist #5: ActivityRecord{42127398/.activities.GuestActivity}
Intent { cmp=/.activities.GuestActivity }
ProcessRecord{414fdf60 15651:/10103}
Hist #4: ActivityRecord{415c86f0 /.activities.UserActivity}
Intent { cmp=/.activities.UserActivity }
ProcessRecord{414fdf60 15651:/10103}
The same problem again, last activity in history. If I press back button I`ll get UserActivity.