android - Calling finish() after launching another activity only works sometimes -


i have splash screen handles automatic login. if user logged in, sends s/he directly main activity, through following code:

intent intent = new intent(activity, mainactivity.class); activity.startactivity(intent); activity.finish(); 

where activity activity finished (i'm not using this because method common automatic logins, manual logins, social logins etc.)

however 70% of time, splash screen still there after finishing main activity. not occur during debugging. looks happens when login happens quickly, why never happens during debugging (because becomes slow).

logging has helped see that, when problem happens finish() indeed being called, ondestroy() not.

i have tried flag_activity_clear_top, doesn't help. nohistory work, brings unwanted finishing animation and, really, want know problem code is. i've used , don't see why fails.

thanks in advance.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -