Question

I have ListView with custom ArrayAdapter. Part of Layout code:

        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <AutoCompleteTextView
            android:id="@+id/aCTVres"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:gravity="center"
            android:inputType="textMultiLine"
            android:maxHeight="50dp"
            android:maxLines="1"
            android:textSize="14sp" >

            <requestFocus />
        </AutoCompleteTextView>

        <AutoCompleteTextView
            android:id="@+id/aCTVDef"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:ems="10"
            android:gravity="center"
            android:maxHeight="50dp"
            android:maxLines="1"
            android:textSize="12sp" />

    </LinearLayout>

In getView() I call setText() to all of the AutoCompleteTextView . After I need to return focus to the first AutoCompleteTextView. How can I do this?

Was it helpful?

Solution

For xml : android:completionThreshold="1" there is no set selection for AutoCompleteTextView only threshold

"When threshold is less than or equals 0, a threshold of 1 is applied.".

 <AutoCompleteTextView
            android:id="@+id/aCTVres"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:gravity="center"
            android:inputType="textMultiLine"
            android:maxHeight="50dp"
            android:maxLines="1"
            android:textSize="14sp"
            android:completionThreshold="1" >

            <requestFocus />
        </AutoCompleteTextView>

java

autotexttiew.setThreshold(2);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top