title: How to pass string data to popup or dialog menu
body: <p>I have a name in a TextView. When I click the name "Laura Aikman", I want to pass the mobile number "1111111111111" to the "Call" option on a popup or dialog menu. When I click the name "Sarah Alexander", I want to pass the mobile number "222222222222".</p>
  
  <p>Java code:</p>
  
  <pre><code>package com.nasir.dialogmenu;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  public class MenuDemoActivity extends Activity {
         TextView Laura_Aikman;
         TextView Sarah_Alexander;
         TextView Anthony_Andrews;
  
         @Override
         public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                final String[] option = new String[] { "Call", "SMS", "Save", "Share" };
                ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.select_dialog_item, option);
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
  
                builder.setTitle("Select Option");
                builder.setAdapter(adapter, new DialogInterface.OnClickListener()
                { 
                public void onClick(DialogInterface dialog, int which)
                {
                // TODO Auto-generated method stub
  
  
                }
                });
  
                final AlertDialog dialog = builder.create();
  
                Laura_Aikman = (TextView) findViewById(R.id.Laura_Aikman);
                Laura_Aikman.setOnClickListener(new View.OnClickListener() {
                      public void onClick(View v) {
                             dialog.show();
  
                       }
                });
  
                Sarah_Alexander = (TextView) findViewById(R.id.Sarah_Alexander);
                Sarah_Alexander.setOnClickListener(new View.OnClickListener() {
                       public void onClick(View v) {
                             dialog.show();
                       }
                });
  
                Anthony_Andrews = (TextView) findViewById(R.id.Anthony_Andrews);
                Anthony_Andrews.setOnClickListener(new View.OnClickListener() {
                       public void onClick(View v) {
                             dialog.show();
                       }
                });
         }
  }
  </code></pre>
  
  <p>XML code:</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="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
     &lt;TextView
         android:id="@+id/Laura_Aikman"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         android:layout_marginTop="20sp"
         android:textSize="25sp"
         android:layout_gravity="center"
         android:text="Laura Aikman"/&gt;
  
     &lt;TextView
         android:id="@+id/Sarah_Alexander"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         android:layout_marginTop="20sp"
         android:textSize="25sp"
         android:layout_gravity="center"
         android:text="Sarah Alexander"/&gt;
  
     &lt;TextView
         android:id="@+id/Anthony_Andrews"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         android:layout_marginTop="20sp"
         android:textSize="25sp"
         android:layout_gravity="center"
         android:text="Anthony Andrews"/&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>