I have the following issue:
Inside a fragment let say FragmentTest, i am having the following thread:
new Thread(new Runnable() {
public void run() {
...
if (condition) {
if (isAdded()) {
getActivity.runOnUiThread(new Runnable () {
public void run() {
rightEditText.addTextChangedListener(FragmentTest.this);} }
}
}
}
...
}
}).start;
inside of onCreate method.
The FragmentTest implements the TextWatcher interface but none of the interface method is called.
Migrating the comment to the answer:
Why do you need to do this inside a separate thread? I think the problem is that all the UI components run on the main UI thread. Try it without the thread.
I guess no further explanation is needed here. OP migrated his code to the UI thread and it worked.