title: Need to retrieve a value from alertDialog
body: <p>I have an SQLite DataBase and I need to store some values that I put into an AlertDialog.</p>
  
  <p>This is my code:</p>
  
  <pre><code> boton1.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
  
                  final TextView asd = (TextView)findViewById(R.id.textView1);
  
                  // get prompts.xml view
                  LayoutInflater li = LayoutInflater.from(context);
                  View promptsView = li.inflate(R.layout.dialog, null);
  
                  AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                          context);
  
                  // set prompts.xml to alertdialog builder
                  alertDialogBuilder.setView(promptsView);
  
                  final EditText userInput = (EditText) promptsView
                          .findViewById(R.id.editTextDialogUserInput1);
                  final String uI1 = userInput.getText().toString().trim();
  
                  final EditText userInput1 = (EditText) promptsView
                          .findViewById(R.id.editTextDialogUserInput2);
                  final String uI2 = userInput1.getText().toString().trim();
  
                  final EditText userInput2 = (EditText) promptsView
                          .findViewById(R.id.editTextDialogUserInput3);
                  final String uI3 = userInput2.getText().toString().trim();
  
                  // set dialog message
                  alertDialogBuilder
                          .setCancelable(false)
                          .setPositiveButton("Aceptar",
                                  new DialogInterface.OnClickListener() {
                                      public void onClick(DialogInterface dialog,int id) {
                                          asd.setText(uI1);
                                         if(db != null){
                                             db.execSQL("INSERT INTO Usuarios (nombre, apellidos, localidad) " +
                                                     "VALUES ('" + uI1 + "', '" + uI2 + "', '" + uI3 + "')");
  
  
  
                                         }
                                      }
                                  })
                          .setNegativeButton("Cancelar",
                                  new DialogInterface.OnClickListener() {
                                      public void onClick(DialogInterface dialog, int id) {
                                          dialog.cancel();
                                      }
                                  });
  </code></pre>
  
  <p>The TextView is to check if the value Im getting is wrong but Im getting an empty String in both sides, the TextView and in the database value, what am I missing? The references to dialog.xml are just fine, I have 3 EditTexts named editTextDialogUserInput1, 2 and 3</p>