Calling completion () after starting another activity only works sometimes
I have a splash screen that handles automatic login. If the user is logged in, it sends s / he directly to the main activity via the following code:
Intent intent = new Intent(activity, MainActivity.class); activity.startActivity(intent); activity.finish();
If the activity is a complete activity (I don't use
it because this method is common for automatic logins, manual logins, social logins, etc.)
However, about 70% of the time, the splash screen still remains after the main activity has completed. This does not happen during debugging. It looks like it happens when the login is fast, so it probably never happens during debugging (because things get slow).
Logging helped me figure out what is
actually called when the problem occurs , but is
it but it doesn't help.
works but brings unnecessary finishing animation and really I want to know what is the problem with this code. I've always used it and don't understand why it fails.
Thanks in advance.
source to share
No one has answered this question yet
See similar questions: