I have a listview.in each item there is a textview and an edittext.. i have followed this but it doesnt helped me a lot.then tried with this but still no help.I have declared an edittext for listview item like this.
<EditText
android:id="@+id/dhsv1"
android:layout_width="15dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:editable="true"
android:maxLength="2"
android:focusable="false"
android:focusableInTouchMode="true"
android:imeOptions="flagNoExtractUi|actionDone"
android:inputType="textVisiblePassword|number" />
then in getview method i have done this
number.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
number.setFocusableInTouchMode(true);
number.setFocusable(true);
return false;
}
});
after that i have even done inside listviewonitemclick
number.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
number.setFocusableInTouchMode(true);
number.setFocusable(true);
number.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_DONE){
number.clearFocus();
}
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(number.getWindowToken(), 0);
}
return false;
}
});
return false;
}
});
now many may wonder why i have written number.setontouchlistener in both getview as well as listview onitemclick.even i dont find any correct logic but thing is that its working for me.NOw actual problem is that when i click on any edittext(i.e number in my case) it gains focus but it does not allow to select or deselect its own item or any other item in the listview.even i have cleared the focus through coding.Any one please with some good solution please..