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>

How to open google play link app when you click over image in your app

How to open google play link app when you click over image in your app

Java:

ImageView SeniarImage = (ImageView)findViewById(R.id.SeniarImage);
SeniarImage.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View v) {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=ae.gov.moccae.seniar&hl=en"));
        startActivity(intent);
    }
});

XML: 

<ImageView    android:id="@+id/SeniarImage"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_below="@+id/MoccaeAppImage"    android:layout_marginLeft="2dp"    android:layout_marginRight="2dp"    android:layout_marginBottom="2dp"    android:contentDescription="Seniar"    android:paddingRight="5dp"    android:paddingBottom="0dp"    android:src="@drawable/seniarimage" />

How to create a button that open a new activity in android - انشاء زر تستطيع من خلاله فتح نافذة جديدة

How to create a button that open a new activity in android :

Java:

rotected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);


    Button start = (Button)findViewById(R.id.Strat);
    start.setOnClickListener(new View.OnClickListener() {
        @Override        public void onClick(View v) {
            Intent i = new Intent(MainActivity.this,dept.class);
            startActivity(i);
        }
    });

XML: 

<LinearLayout    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:gravity="center"    android:orientation="vertical">
 <Button        android:id="@+id/Strat"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginTop="70dp"        android:background="@drawable/start"        android:paddingLeft="125dp"        android:paddingRight="125dp"        android:textAlignment="center"        android:textColor="@color/colorewhite"        android:textSize="25sp" />

</LinearLayout>

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