-2

I have activity a and b, when I in activity b and preesed on the back key I back from activity b to activity a, How do I make that when I back to activty a, activty a will be restart?

amit8s
  • 1

1 Answers1

0

When your are launching activity B you should call finish() on activity A

 Intent intent=new Intent(this.,B.class)
 startActivity(intent);
    finish():

**override onBackPressed method of the Activity b **

@Override
        public void onBackPressed() {
            // TODO Auto-generated method stub
            super.onBackPressed();
            Intent intent=new Intent(this,A.class);
            startActivity(intent);
            finish();
        }
Arun Salaria
  • 984
  • 6
  • 20