After many searches I came across the following situation: I'm on my Main Activity and would like to open another Activity (passing parameters to Activity2 ), then use the button back on the toolbar and return to the main.
Problems:Iamunabletomaintainthemainclassinstance,whentheActionBarreturnismade,MainActivity,thuslosingthecurrentstatusofmain.
Note1:Parameterpassagesareok,onlymissingthemaininstance.
intent2=newIntent(this,meditate.class);publicvoidpassartextos(StringtituloE,StringtextoE){intent2.putExtra("titulo", tituloE);
intent2.putExtra("texto", textoE);
startActivity(intent2);
}
In the activity meditate the changes in the XML were done according to a forum topic BR StackOverFlow // getSupportActionBar () for button (arrow) Home and back arrow ←
In class meditate was introduced the line that supportactionbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
and AndroidManifest
<activity android:name=".meditate"
android:parentActivityName=".MainActivity"></activity>
In kids, the problem comes down to:
MainActivity - > Meditate
Meditate - > New MainActivity