Reputation: 91
I am writing a program which contain listview .
listview
has one text boz and one edittext
.
i want to know the position clicked inside the addTextChangedListener
Upvotes: 1
Views: 684
Reputation: 11
You can catch the position like below,
I use onFocus
because if you use addTextChangedListener
, it will assign the value for every typing.
Put the position to edittext
tag then you can get it by getTag()
.
edittext.setId(position);
final int sPosition;
edittext.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
sPosition = v.getId();
}
});
edittext.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start,int before, int count) {
//
}
@Override public void beforeTextChanged(CharSequence s, int start,int count, int after) {
//
}
@Override public void afterTextChanged(Editable s) {
// sPosition
}
});
Upvotes: 1