Android AlertDialog Example
Giving information to the user, either to continue the process or to cancel.We can get AlertDialog through AlertDialog.Builder(Context). We can set AlertDialog title through AlertDialog.setTitle("AlertDialog Sample") and set message through AlertDialog.setMessage("Do you want to Hide/Show Button"); Full code package com.etr.alertdialogexample; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; public class MainActivity extends Activity { Button hide, action; @Override protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); hide = (Button)findViewById(R.id.button1); action = (Button)findViewById(R.id.button2);