I have a code sample that uses this function to run a thread runOnUiThread. why and when may we need to use it?
edit
What about to use AsyncTask class, what’s the pros and cons??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to use
runOnUiThread()when you want to update your UI from a Non-UI Thread. For eg- If you want to update your UI from a background Thread. You can also useHandlerfor the same thing.From the Docs –
Syntax –
Update –
From the Docs –