Update View at runtime in Android

前端 未结 3 1164
傲寒
傲寒 2021-01-13 08:53

The example is pretty straightforward: i want to let the user know about what the app is doing by just showing a text (canvas.drawText()). Then, my first message appears, bu

3条回答
  •  無奈伤痛
    2021-01-13 09:36

    First: onCreate is executed on main UI thread of application so no UI updates until you leave it. Basically you need one thread to execute long running tasks and some mechanism to push updates into the UI.
    Most usual approach is to extend AsyncTask see this link for further info

提交回复
热议问题