title: Set value to a textview in the activity
body: <p>On the event invocation of an activity, I opened an AlertDialog.Builder which lists an array of single choice items. When the user clicks any item, I want to set the same to a text view in the activity.</p>
  
  <pre><code>I tried this:
  Activity class:
  public MyActivity extends Activity implements onClickListener {
       TextView item;
       public void onCreate(Bundle state) {
          super.onCreate(savedState);
          setContentView(R.layout.main);
          item = (TextView) findViewById(R.id.id_item);
          item .setOnClickListener(this);
       }
       public void onClick(View v) {
            new MyBuilder(this).show();
            updateUI();
       }
       private void updateUI() {
            item.setText(ItemMap.item);
       }
  }
  
  Builder class: 
  
  public class MyBuilder extends AlertDialog.Builder implements OnClickListener{
  
  Context context;
  String[] items = {"pen", "pencil", "ruler"};
  public MyBuilder(Context context) {
      super(context);
      super.setTitle("Select Item");
      this.context = context;
      super.setSingleChoiceItems(items, 0, this);
  
  }
  
  @Override
  public void onClick(DialogInterface dialog, int position) {
      ItemMap.item = items[position];
      dialog.dismiss();
  }
  }
  
  Mapping class: 
  
  public class ItemMap {
      public static String item;
  }
  </code></pre>
  
  <p>Here, MyBuilder is a subclass extending AlertDialog.Builder<br>
  updateUI() tries to set the value which user chooses from the list of items. But it did not work! updateUI() is called soon after the dialog is shown.</p>
  
  <p>Could anyone help me out?</p>
  
  <p>Thanks in advance!</p>