Android: How to update an UI from AsyncTask if AsyncTask is in a separate class?

后端 未结 7 2102
半阙折子戏
半阙折子戏 2020-12-02 12:33

I hate inner class.

I\'ve a main activity who launches a \'short-life\' AsyncTask.

AsyncTask is in a separate file, is not an inner class of

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 12:52

    Just pass the context (activity or whatever) to your AsyncTask in a constructor and then in onSuccess or onProgressUpdate call whatever you need on the context.

提交回复
热议问题