title: Get text from alertDialog
body: <p>i have a textView in the alertDialog, and i want to get this text when the user click on Ok button...</p>
  
  <p>however i dont know how to implement it? (in google android developer it doesnt explain)</p>
  
  <p>here is my forgot_password_popup.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:background="@null" &gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="80dp"
          android:layout_weight="0.76"
          android:background="#FFFFBB33"
          android:contentDescription="@string/app_name"
          android:scaleType="center"
          android:src="@drawable/logo" /&gt;
  
      &lt;EditText
          android:id="@+id/emailText"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="4dp"
          android:layout_marginLeft="4dp"
          android:layout_marginRight="4dp"
          android:layout_marginTop="16dp"
          android:hint="Enter Email Address"
          android:inputType="textEmailAddress" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>this is my updated class:</p>
  
  <pre><code>public class LoginDialogFragment extends DialogFragment {
  
      private EditText emailText;
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
  
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          // Get the layout inflater
          LayoutInflater inflater = getActivity().getLayoutInflater();
          final View v = inflater.inflate(R.layout.forgot_password_popup, null);
            emailText = (EditText) v.findViewById(R.id.emailText);
  
  
          // Inflate and set the layout for the dialog
          // Pass null as the parent view because its going in the dialog layout
          builder.setView(inflater.inflate(R.layout.forgot_password_popup, null))
          // Add action buttons
                 .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                     @Override
                     public void onClick(DialogInterface dialog, int id) {
  
                         try {
                             String email=emailText.getText().toString();
                          ParseUser.requestPasswordReset(email);
                      } catch (ParseException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                     }
                 })
                 .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface dialog, int id) {
  
                         LoginDialogFragment.this.getDialog().cancel();
                     }
                 });      
          return builder.create();
      }
  }
  </code></pre>
  
  <p>this is the logcat (as you can see it wrote invalid email because email is empty):</p>
  
  <pre><code>03-05 17:42:27.791: W/System.err(751): com.parse.ParseException: invalid email 
  03-05 17:42:27.791: W/System.err(751):  at com.parse.ParseCommand$3.then(ParseCommand.java:352)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$10.run(Task.java:442)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$1.execute(Task.java:67)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task.completeImmediately(Task.java:439)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task.continueWith(Task.java:316)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task.continueWith(Task.java:327)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$8.then(Task.java:377)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$8.then(Task.java:1)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$11.run(Task.java:474)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$1.execute(Task.java:67)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task.completeAfterTask(Task.java:471)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task.access$9(Task.java:467)
  03-05 17:42:27.801: W/System.err(751):  at com.parse.Task$7.then(Task.java:343)
  03-05 17:42:27.811: W/System.err(751):  at com.parse.Task$7.then(Task.java:1)
  03-05 17:42:27.811: W/System.err(751):  at com.parse.Task.runContinuations(Task.java:502)
  03-05 17:42:27.811: W/System.err(751):  at com.parse.Task.access$5(Task.java:498)
  03-05 17:42:27.821: W/System.err(751):  at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:557)
  03-05 17:42:27.821: W/System.err(751):  at com.parse.Task$TaskCompletionSource.setResult(Task.java:591)
  03-05 17:42:27.821: W/System.err(751):  at com.parse.Task$11$1.then(Task.java:485)
  03-05 17:42:27.821: W/System.err(751):  at com.parse.Task$11$1.then(Task.java:1)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task$10.run(Task.java:442)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task$1.execute(Task.java:67)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task.completeImmediately(Task.java:439)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task.access$8(Task.java:435)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task$6.then(Task.java:309)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task$6.then(Task.java:1)
  03-05 17:42:27.832: W/System.err(751):  at com.parse.Task.runContinuations(Task.java:502)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task.access$5(Task.java:498)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:557)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$TaskCompletionSource.setResult(Task.java:591)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$11$1.then(Task.java:485)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$11$1.then(Task.java:1)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$10.run(Task.java:442)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task$1.execute(Task.java:67)
  03-05 17:42:27.841: W/System.err(751):  at com.parse.Task.completeImmediately(Task.java:439)
  03-05 17:42:27.851: W/System.err(751):  at com.parse.Task.continueWith(Task.java:316)
  03-05 17:42:27.851: W/System.err(751):  at com.parse.Task.continueWith(Task.java:327)
  03-05 17:42:27.851: W/System.err(751):  at com.parse.Task$11.run(Task.java:478)
  03-05 17:42:27.861: W/System.err(751):  at com.parse.Task$1.execute(Task.java:67)
  03-05 17:42:27.861: W/System.err(751):  at com.parse.Task.completeAfterTask(Task.java:471)
  03-05 17:42:27.871: W/System.err(751):  at com.parse.Task.access$9(Task.java:467)
  03-05 17:42:27.871: W/System.err(751):  at com.parse.Task$7.then(Task.java:343)
  03-05 17:42:27.871: W/System.err(751):  at com.parse.Task$7.then(Task.java:1)
  03-05 17:42:27.871: W/System.err(751):  at com.parse.Task.runContinuations(Task.java:502)
  03-05 17:42:27.871: W/System.err(751):  at com.parse.Task.access$5(Task.java:498)
  03-05 17:42:27.882: W/System.err(751):  at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:557)
  03-05 17:42:27.882: W/System.err(751):  at com.parse.Task$TaskCompletionSource.setResult(Task.java:591)
  03-05 17:42:27.882: W/System.err(751):  at com.parse.Task$3.run(Task.java:225)
  03-05 17:42:27.882: W/System.err(751):  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
  03-05 17:42:27.882: W/System.err(751):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  03-05 17:42:27.891: W/System.err(751):  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
  03-05 17:42:27.891: W/System.err(751):  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
  03-05 17:42:27.891: W/System.err(751):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  03-05 17:42:27.901: W/System.err(751):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  03-05 17:42:27.901: W/System.err(751):  at java.lang.Thread.run(Thread.java:856)
  </code></pre>