title: How do I show a DIalog Fragment?
body: <p>Hi I wanted to know how I could show a dialog on screen when the user clicks on a button;</p>
  
  <p>java file; </p>
  
  <pre><code>public class Example extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.example_layout);
  
          findViewById(R.id.exampleButton).setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  Log.i("Jomin","sdsd");
                  ExampleDialogFragment CallUs = new ExampleDialogFragment();
                  CallUs.getDialog();
              }
          });
      }
  }
  </code></pre>
  
  <p>this the ExampleDialogFragment java file;</p>
  
  <pre><code>public class ExampleDialogFragment extends android.support.v4.app.DialogFragment {
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
  
          final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          builder.setCancelable(false);      builder.setTitle(R.string.LogOutTitle).setMessage(R.string.LogOutMessage).setPositiveButton(R.string.LogOutPositive,new DialogInterface.OnClickListener() {
  
              @Override
              public void onClick(DialogInterface dialog, int which) {
  
                  Uri number = Uri.parse("tel:0845 3000 116");
                  Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
                  startActivity(callIntent);
              }
          });
  
          AlertDialog dialog = builder.create();
          return dialog;
      }
  }
  </code></pre>
  
  <p>So can someone tell me how I would be able to show this dialog when the user clicks on button with the ID - exampleButton. </p>