I am making an android application where I am using the AutoCompleteTextView
and trying to set the onClickListener for reset the entered value on click on AutoCompleteTextView
.
Issue is that I have two AutoCompleteTextView
so when I entered text in first AutoCompleteTextView
then second AutoCompleteTextView
then click on first AutoCompleteTextView
then it is not calling OnClickListener on the first AutoCompleteTextView
Any idea why this is behaving such weird ?
<AutoCompleteTextView
android:id="@+id/fromStationEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/TextView1"
android:layout_marginLeft="12dp"
android:layout_marginTop="3dp"
android:background="@drawable/apptheme_edit_text_holo_light"
android:drawableRight="@drawable/ic_rail"
android:focusable="true"
android:focusableInTouchMode="true"
android:imeOptions="actionNext"
android:paddingLeft="8dp"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHighlight="@android:color/black"
android:textCursorDrawable="@null"
android:textSize="16sp" >
<requestFocus />
</AutoCompleteTextView>
ClickListener on AutoCompleteTextView
.
// reset the value when user click on this view
source_stn_txt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
source_stn_txt.setText("");
}
});
// reset the value when user click on this view
dest_stn_txt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
dest_stn_txt.setText("");
}
});
source_stn_txt.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
source = source_stn_txt.getText().toString().trim();
dest_stn_txt.requestFocus();
}
});
Thanks in advance.