When I press back button
in my android application or close the app, it terminates and I want my app to be terminated when I press the logout button.
I only want my app to be terminated when I press the logout button, otherwise not, whether I press back button
or close it by minimizing the app.
What should I do?
For the back button, I used this simple code
@Override
public void onBackPressed()
{
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
moveTaskToBack(true);
if (drawer.isDrawerOpen(GravityCompat.START))
{
drawer.closeIrawer(GravityCompat.START);
}
else
{
super.onBackPressed();
}
}
Should I do something with these lines?
Or should make any web services for this?