title: Not able to setPositiveButton
body: <p>I want to display the dialog with two buttons "ENABLE GPS" and "CANCEL" as soon as the application starts before the Launcher activity if the GPS is off otherwise if GPS is on, the launcher activity gets opened.And when user clicks on "Enable GPS" it will it to the GPS settings and when User clicks Cancel, I want to display another Dialog Titled "how to user App" with Button "OK" and when user clicks "Ok" i want the launcher activity to gets opened.
  For this i am using the following code:</p>
  
  <pre><code>    if (!isGPSEnabled) {
          // no GPS provider is enabled
          // Creating the Dialog box
          AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this)
                  .create();
          alertDialog.setTitle("Settings");
          alertDialog.setMessage("Enable GPS for accessing the Application");
          alertDialog.setButton("GPS Settings",
                  new DialogInterface.OnClickListener() {
                      // creating Button i.e GPS Setting in the Dialog Box
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          // TODO Auto-generated method stub
  
                          startActivity(new Intent(
                                  android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
  
                      }
                  });
          alertDialog.show();
          // creating Button i.e Cancel in the Dialog Box
          alertDialog.setButton2("Cancel",
                  new DialogInterface.OnClickListener() {
  
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          // TODO Auto-generated method stub
                          // Creating another Dialog when "Cancel" is pressed
                          AlertDialog whencancelpressed = new AlertDialog.Builder(
                                  MainActivity.this).create();
                          whencancelpressed.setTitle("How to use the app");
                          whencancelpressed
                                  .setMessage("Enter the contacts to whom you want to send the message.Double tap power button in emergency");
                          whencancelpressed.setButton("Ok",
                                  new DialogInterface.OnClickListener() {
                                      @Override
                                      public void onClick(
                                              DialogInterface dialog,
                                              int which) {
                                          // TODO Auto-generated method stub
                                          Intent pressedokay = new Intent(
                                                  getApplicationContext(),
                                                  MainActivity.class);
                                          startActivity(pressedokay);
                                      }
                                  });
                          whencancelpressed.show();
                      }
                  });
  
      } else {
          // GPS provider is enabled
      }
  </code></pre>
  
  <p>Problems that i am facing is, i am not able to make "cancel" button display and when after going through several tutorials , i tried to change the setButton to setPositiveButton , eclipse is showing me error.</p>