I cant seem to set my spinners position back to what it was before I called a second activity.
Layout of App:
Activity “Main” has a spinner and 8 buttons, the user selects a item from the spinner and then clicks on an button to open that activity (I do NOT call “finish()” on the “Main” Activity). After the user is finished with the second activity I exicute the following code to bring the “Main” activity back to front.
private void exitActivity() {
Intent mainIntent = new Intent(this, Main.class);
startActivity(mainIntent);
finish();
}
My problem is that my spinner in the “Main” activity is always set back to position 0 and not to what was selected prior to the user going to the second activity.
Thanks for you help.
Looking like an idiot in 3, 2, 1…
Why are you doing?:
Calling
finish()is enough to get you back to the Activity in which the second activity was started.Since that activity didn’t close, the spinner will be like it was before you started the second activity.