help with Handler class to update UI - Android

前端 未结 1 1188
生来不讨喜
生来不讨喜 2021-01-28 16:56

I am hoping you can help me:

I need to update my ui for an android app and I\'m trying to use the Handler class to do it, using http://developer.android.com/resources/ar

相关标签:
1条回答
  • 2021-01-28 17:26

    On Android it's best to use AsyncTask to execute tasks in the background while (progressively) updating UI with results from this task.

    Edited:

    After checking code I think your Handler works correctly. Probably problem is in UpdateDisplay(). Since you are updating display from background thread, make sure you call [view.postInvalidate()][2] after you're done updating your View.

    0 讨论(0)
提交回复
热议问题