ashok
ashok

Reputation: 9

How can we move to previous screen when action performed

I am new to android...I want to move back to the previous screen when i pressed some button in current screen..how can we implement? ... Thanks in advance

Upvotes: 0

Views: 350

Answers (3)

The Idiom
The Idiom

Reputation: 21

Within the onClickListener for the button you put finish();

Upvotes: 2

Burak Dede
Burak Dede

Reputation: 3743

If preserving the state of the first activity not important you can just create an Intent and just call the first activity. Here how you can do that.Do this at second activity which will call the first one.

Intent myIntent = new Intent();         myIntent.setClass(getApplicationContext(),NameOfTheFirstActivityClass.class);
startActivity(myIntent);

Upvotes: 0

Hakan Ozbay
Hakan Ozbay

Reputation: 4719

To end the current activity and go to the previous activity you can just call finish()

Upvotes: 3

Related Questions