I am having trouble giving the action to the home button, I am able to smoothly implement the button according to the code ↓
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
But I do not know how to define what activity it should go to and how to "kill" the activity it is in. The one described so far is the one indicated in the image below as 1
Iwouldlikehelpalsowithwhatisdescribedas2,itworkstogobacktothepreviousscreen,butIwouldliketosetittoreturntothemainscreen,butIhavenotyetfoundanymethodtohandlethisbutton.
Theideaisforthe1buttontogobacktothepreviousactivityandthe2buttontogobacktotheactivityin>main" Home " and that whenever it returns to any place the closed page is "killed", thus not consuming processing with what would not be being used.