New answers tagged

0 votes

Should I wrap all codes into runOnUiThread even some code doesn't need to run on UI thread?

Never, ever, ever wait for anything on a UI thread. You call an asynchronous method to read data from the internet, which might take some time, pass a callback method, and that method runs the rest of ...
gnasher729's user avatar
  • 42.7k
0 votes

Should I wrap all codes into runOnUiThread even some code doesn't need to run on UI thread?

Based on my experience you shouldn't put the codes that are irrelevant to UI inside the runOnUiThread {} block. for example when you need to check the MediaPlayer status (playing or stopped) inside a ...

Top 50 recent answers are included