I’m curious about one thing. How can I finish my current activity and start another one.
Example :
MainActivity
--(starts)--> LoginActivity
--(if success, starts)--> SyncActivity
--(if success start)--> MainActivity (with updated data).
So I want when SyncActivity starts MainActivity after succesfull sync and if I press back button not to return to SyncActivity or any other activity opened before SynActivity.
I’ve tried with this code :
Intent intent = new Intent(Synchronization.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
this.finish();
but it’s not working properly. Any ideas how to get the things to work properly?
Use