-3

MainActivity --(starts)--> LoginActivity--(if login success)-->MainActivity (with updated data).

I want to finish LoginActivity then start MainActivity with layout login successfull

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?

Ramya Selvarani
  • 499
  • 1
  • 9
  • 23
  • 2
    add more information to understand your problem – R9J Jan 09 '14 at 09:50
  • follow my answer and get solution – Satyaki Mukherjee Jan 09 '14 at 10:11
  • It's very easy yesterday I have solved this kind of same problem. Follow this tutorial and get full answer:: http://stackoverflow.com/questions/20995643/finish-activity-in-backstack-android/20996131#20996131 http://stackoverflow.com/questions/20995643/finish-activity-in-backstack-android/20996131#20996131 – Satyaki Mukherjee Jan 09 '14 at 10:11

2 Answers2

1

have a try with

Intent intent = new Intent(Synchronization.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Jitesh Upadhyay
  • 5,244
  • 2
  • 25
  • 43
1

You could only finish LoginActivity ,not need start Activity again . You could update data on onResume of MainActivity

I am sorry for my bad English

Simon Xu
  • 156
  • 5