Setting Textview Visible From Another Thread Or Begininvoke In Android
I'm developing an Android 2.2 application. I have an event listener on an activity, and I want to set visible a TextView when I receive an event. But there is an error: I only can
Solution 1:
You can use Activity#runOnUiThread
or an AsyncTask
as the two easiest ways to duplicate the BeginInvoke
functionality; with runOnUiThread
being the one most similar.
For more complicated or performance orientated needs (i.e., you do not want to keep creating a large number of Runnable
objects) you can use a Handler
. However, I do not recommend it as your first choice.
Post a Comment for "Setting Textview Visible From Another Thread Or Begininvoke In Android"