Keep getting error with keyword logout in switch statement as as cannot resolve symbol logout. want to put icon on action bar but don't know how to setup action bar. help me setup action bar resolve this issue as well please. thanks
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
//handle presses on the action bar items
switch (item.getItemId())
{
case R.id.logout:
{
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setMessage("Do you want to logout?").setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(Attendence.this,ChoosePanel.class));
} //public void onClick(DialogInterface dialog, int id)
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//action for 'NO' button
dialog.cancel();
} //public void onClick(DialogInterface dialog, int id)
});
//creatin dialog box
AlertDialog alert=builder.create();
//setting the title manually
alert.setTitle("LOGOUT");
alert.show();
return true;
}