I am using the TextWatcher()
method to listen on my EditText
.
It has a method called afterTextChanged(Editable s)
I want to display a Toast
saying "Changes saved" in this method.
For the Toast.makeText(Context context, "message", Toast.LENGTH_SHORT).show();
What context I should pass in ??. I have already tried this and "name_of_Fragment.this
" but it wont work.
Anybody knows what to do ??
mTitleField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//Nothing to do!!
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//save the text and overwrite
mCrime.setTitle(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
// I want the Toast here!!
}
});
return v;
}