How to set a dialog when you click an item in menu items

How to set a dialog when you click an item in menu items

Java:


if(id==R.id.About)
{

AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
 //Read UpdatealertDialog.setTitle("About");
alertDialog.setMessage("This App Includes information about Moccae Employees and Departments\n" + "Version: v 0.0");


alertDialog.setButton("Exit..", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
       
        dialog.cancel();
    }
});

alertDialog.show();}

XML:



<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" 
   xmlns:app="http://schemas.android.com/apk/res-auto">

<item    android:id="@+id/About"  
  android:title="@string/About"  
  app:showAsAction="never" />


</menu>

1 comment:

How to set  interstitial  ads to be show for each n seconds ? ScheduledExecutorService schedul = Executors. newSingleThreadScheduledExec...