Reputation: 6121
I'm getting a ResourceNotFoundException
and I don't know why.
mTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.length() > 0) {
mTextView.setText(String.valueOf(s.charAt(s.length() - 1)));
mTextView.setText("bla-bla");
}
}
});
LogCat:
07-17 23:24:11.011: E/AndroidRuntime(15696): android.content.res.Resources$NotFoundException: String resource ID #0x74
07-17 23:24:11.011: E/AndroidRuntime(15696): at android.content.res.Resources.getText(Resources.java:230)
07-17 23:24:11.011: E/AndroidRuntime(15696): at android.widget.TextView.setText(TextView.java:3769)
When I use setText
not in this onTextChanged
method it's working fine.
Why am I getting this exception?
EDIT
Even If I will somehow manage to get knowledge about this error I will have ifinite loop in afterTextChange method. Because I'm editing text in this method.
This question is related to that So please, help me.
Upvotes: 0
Views: 1308
Reputation: 1325
You will also run in an infinite loop after you fix your error as you are calling settext in text changed
Upvotes: 1