On Tue, Jul 13, 2010 at 1:38 PM, guich <[email protected]> wrote:
> I have a situation where i want to show a dialog. However, the code
> that calls the method to show the dialog can be running either in the
> ui thread or not.
>
> How can i find if the current thread is running in the ui thread or
> not?
Actually, for that case, you may as well just wrap it in a Runnable
and call runOnUiThread():
runOnUiThread(new Runnable() {
public void run() {
// launch your dialog here
}
});
This will ensure that the code runs on the UI thread, regardless of
whether you are on the UI thread or not.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android 2.2 Programming Books: http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en