I stack with this, I’m trying to create application using TabLayout. I have 3 tabs (3 different activities). I also got service which reads my gps position – that works fine. I got thread which post to the web server user position – that works to.
Now I’m trying to create thread which ask web server if there are any messages for user. If there are – thread try to show custom dialog (2 text views and gallery – it works if i start action from activity by clicking button), and there problem starts I know i can’t update UI form threads different from main thread but i don’t know how to work around this. I tried to use AsyncTask – failed – i don’t want to assign AsyncTask to specific Activity as inner private class.
I wish I could show my custom dialog regardless of the tab on which user is currently using.
Thread works fine, but how to show that dialog.
I read about runOnUIThread but don’t know how to use it.
Any ideas, any similar examples ??
Using
runOnUiThreadis easy.