How to get the value in text view on selection of List View?
<p>I have used a List view for the list of related Items and a text view, I wanted to show the value of string in text view on the basis of selected item/value of a List View dyanmically.I have used this code but it will not showing the value in the textview.</p>

<p>My.xml file</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;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ButtonsTable"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:stretchColumns="*"&gt;
       &lt;TableRow android:layout_width="wrap_content"
         android:layout_height="fill_parent"
         android:gravity="left"
         android:layout_marginBottom="20dip"&gt;
         &lt;ListView android:id="@+id/dancsh" 
            android:layout_height="130dip" 
            android:layout_width="100dip"
            android:divider="#FFCC00"
            android:dividerHeight="4px"&gt;
        &lt;/ListView&gt;
      &lt;/TableRow&gt;
 &lt;TableRow android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:gravity="left"
              android:layout_marginTop="30dip"&gt;
    &lt;TextView android:id="@+id/text" 
         android:gravity="center" android:layout_height="90dip" 
         android:layout_width="100dip" android:layout_gravity="center"
         android:textColor="@android:color/white"&gt;
         &lt;/TextView&gt;
  &lt;/TableRow&gt;
 &lt;/TableLayout&gt; 
&lt;/LinearLayout&gt;       
</code></pre>

<p>my.java file</p>

<pre><code>import com.edu.Optionsmenu.R.string;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;

public class my extends Activity {
//  private ListView list;
//  private String str[]={"Android","iPhone","BlackBerry","AndroidPeople"};
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.autocomplete);
    final ListView ls =(ListView)findViewById(R.id.dancsh);
     // By using setAdpater method in listview we an add string array in list.
     ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(AutoComplete.this,android.R.layout.simple_list_item_1,new String[]{"Item1","Item2","Item3","Item4","Item5","Item6"});

    ls.setAdapter(adapter); 
    final TextView tx = (TextView)findViewById(R.id.text);
    ls.setOnItemSelectedListener(new OnItemSelectedListener(){
        @Override
        public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                int arg2, long arg3) {
            // TODO Auto-generated method stub
            tx.setText(ls.getSelectedItem().toString());
        }


                    @Override
        public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
            // TODO Auto-generated method stub

        }
        });
}
</code></pre>

<p>}</p>

<p>Help me plzzzzzzzzzzzzzzzzz</p>
