title: Android: Switch case in toast alert Dialog
body: <p>Android: Switch case in toast alert Dialog.</p>
  
  <p>I want to get the string on return. Here is my code:</p>
  
  <pre><code>public String getValue(final int x) {
  
      final String[] c = new String[1];
  
  
      AlertDialog.Builder builder = new AlertDialog.Builder(context);
      builder.setTitle("Title");
      builder.setItems(new CharSequence[]
                      {"1", "2", "3"},
              new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                      // The 'which' argument contains the index position
                      // of the selected item
                      switch (which) {
                          case 0:
                              Toast.makeText(context, "clicked 1", Toast.LENGTH_LONG).show();
                              c[0] = "1";
                              break;
                          case 1:
                              Toast.makeText(context, "clicked 2", Toast.LENGTH_LONG).show();
                              c[0] = "2";
  
                              break;
                          case 2:
                              Toast.makeText(context, "clicked 3", Toast.LENGTH_LONG).show();
                              c[0] = "3";
                              break;
                      }
                  }
              });
      builder.create().show();
  
      return c[0];
  }
  </code></pre>
  
  <p>However it does not return anything!</p>
  
  <p>Does anyone have any idea?</p>