I have to update a TextView
from another class (not a activity) with the result from a method which can be slow to finish its search. While the method don't finish I thought set the TextView
text to something like "loading..." and finally, after method result is ok, set the text to that result. Currently I'm doing something like this:
textView.setText("loading...");
Search s = searcher.search();
textView.setText(s.result);
Firstly, this still freezes the application until result is ok, once didn't not used new Threads
. I know that to set content to Android widgets we have to do it inside the uiThread
, but I don't know how to do it in my case, once I'm not inside a Activity
.
In second place, that approach are not showing the "loading..." text. When I call that code the application just freezes and back with the final text.
Then, how to avoid that freeze/breaking until content is ok?