title: Get an id value from list item with multiple ids in android
body: <p>I am trying to retrieve a certain id when an item in list is clicked on.</p>
  
  <p>How can i retrieve the value +id/name? I want to use it in an alert dialog ash shown below.</p>
  
  <p>I'm currently working with a simple toast which just shows "name" at the moment when a list item is clicked on</p>
  
  <p>Here is the xml code for my list item:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"&gt;
  
  &lt;TextView
    android:id="@+id/text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/image" android:textSize="20dip"   
        android:layout_marginLeft="10dip"/&gt;
  
  &lt;ImageView
    android:id="@+id/image"
    android:layout_width="50dip"
    android:layout_height="50dip"
    android:layout_centerHorizontal="true"
    android:src="@drawable/stub" android:scaleType="centerCrop"/&gt;
  
  &lt;TextView
    android:id="@+id/name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/image"
    android:textSize="20dip" android:layout_marginLeft="10dip"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Alert dialog code: </p>
  
  <p>list.setOnItemClickListener(new OnItemClickListener() {</p>
  
  <pre><code>                    String artistname = "get +id/name here";
                      String items[] = {"Youtube", "Soundcloud"};
                           @Override
                           public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                   int position, long id) {
  
                               AlertDialog.Builder builder = new 
                                       AlertDialog.Builder(JsonActivity.this);
  
                               builder.setTitle(artistname);
                               builder.setItems(items, new   
                                       DialogInterface.OnClickListener() {
                                   public void onClick(DialogInterface dialog, int which) {
  
                               }
                               });
  
                               AlertDialog alert = builder.create();
                               alert.show();
                           }});
  
  
  
  
                  }
  </code></pre>