Note that there are some explanatory texts on larger screens.

plurals
  1. POListView ItemClick MonoDroid
    text
    copied!<p>I have a AutoCompleteTextView, a ListView with a TextView. I want to send the text item that is selected to a Toast statement. Below is my code, followed by my main.xaml, and item_list.xml </p> <pre><code> String[] names = GetAllNames(db1.WritableDatabase); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, Resource.Layout.list_item, names); textView.Adapter = adapter; ListView input1 = (ListView)FindViewById(Resource.Id.lview1); input1.ItemClick += delegate(object sender, ItemEventArgs args) { // When clicked, show a toast with the TextView text Toast.MakeText(Application, ((TextView)args.View).Text, ToastLength.Short).Show(); }; /* main.xaml */ &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;Button android:id="@+id/MyButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/Hello"/&gt; &lt;AutoCompleteTextView android:id="@+id/autocompleteName" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp"/&gt; &lt;ListView android:id="@+id/lview1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; /* list_item.xml */ &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test" android:textSize="20sp" &gt; &lt;/TextView&gt; </code></pre> <p>I'm not seeing the selection when I pick from the list to fill the AutoCompleteText box. </p> <p>Thanks in advance. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload