2 AutoCompleteTextView's, How To Know Which View Has Been Selected
It may seem like a duplicate, but it ain't. I have 2 AutoCompleteTextView's in my layout. From Address, To Address. I need to know which one of them initiated the drop down list. S
Solution 1:
I think I figured it out. The answer is 2 fold.
The
id
value returned byonItemClick
returns 0 for the first autocomplete, and 1 for the second autocomplete07-02 17:24:14.773: E/Taxeeta(12103): -1:-1:0
07-02 17:24:14.773: E/Taxeeta(12103): -1:-1:1
The layout textview's should have id's. That is returned in the view parameter of
onItemClick
For FromLayout
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fromautocomplete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:minLines="3"
android:layout_marginBottom="15dp"
android:textSize="15dp"
android:text="sample text"
android:marqueeRepeatLimit="marquee_forever"/>
For ToLayout
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toautocomplete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:minLines="3"
android:layout_marginBottom="15dp"
android:textSize="15dp"
android:text="sample text"
android:marqueeRepeatLimit="marquee_forever"/>
Post a Comment for "2 AutoCompleteTextView's, How To Know Which View Has Been Selected"