Android Aftertextchanged Get Edittext Tag
I have a DialogFragment containing a ListView, with a custom adapter hooked up to the ListView. The list displays a bunch of items with an EditText for each record to allow the use
Solution 1:
If you would declare your txtQuantity as final and then pass an anonymous new TextWatcher() { ... } into the addTextChangedListener, then you could directly use txtQuantity inside the afterTextChanged(Editable s) method. Hope this helps.
Solution 2:
you can use this code
private Activity activity;
private TextWatcher textWatcher = new TextWatcher() {
@Override
publicvoidafterTextChanged(Editable s) {
View focView=activity.getCurrentFocus();
/* if t use EditText.settxt to change text and the user has no
* CurrentFocus the focView will be null
*/if(focView!=null)
{
EditText edit= (EditText) focView.findViewById(R.id.item_edit);
if(edit!=null&&edit.getText().toString().equals(s.toString())){
edit.getTag()
}
}
}
publicvoidbeforeTextChanged(CharSequence s, int start, int count, int after) {
}
publicvoidonTextChanged(CharSequence s, int start, int before,
int count) {
}
};
publicEditAdapter(ArrayList<HashMap<String, String>> list, Activity activity){
this.activity = activity;
this.list = list;
inflater = LayoutInflater.from(activity);
}
Post a Comment for "Android Aftertextchanged Get Edittext Tag"