I open a new activity by calling startActivityForResult.
Inside my SecondActivity class i have an exit button, when the user clicks it i need to close the SecondActivity.
What method should i call to close SecondActivity?
I tried calling finish() and finishActivity() on my exitButtonClicked, but it didn't do anything.
Inside my SecondActivity class i have an exit button, when the user clicks it i need to close the SecondActivity.
What method should i call to close SecondActivity?
I tried calling finish() and finishActivity() on my exitButtonClicked, but it didn't do anything.
Code:
public class FirstActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
.......
.......
Intent i = new Intent(this , SecondActivity.class);
this.startActivityForResult(i, 1);
}
}
Code:
public class SecondActivity extends Activity {
private void exitButtonClicked()
{
//I need to call a method to close this activity
}
}