I have the following code:
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
builder = new AlertDialog.Builder(atividade);
builder.setTitle("Deseja realmente sair?");
builder.setPositiveButton("Sim", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
finish();
}
});
//Toast.makeText(this, "sair",Toast.LENGTH_SHORT).show();
finish();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
In the excerpt: I'd like to ask if you'd really like to leave.
If it says yes, the application is terminated. And if he says no, the screen is kept.
How do I try to work, but do not want to!