AsyncTask and error handling on Android

前端 未结 12 2165
失恋的感觉
失恋的感觉 2020-11-27 10:32

I\'m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the

12条回答
  •  爱一瞬间的悲伤
    2020-11-27 11:05

    It works fine but is it the "right" approach and is there better alternative?

    I hold onto the Throwable or Exception in the AsyncTask instance itself and then do something with it in onPostExecute(), so my error handling has the option of displaying a dialog on-screen.

提交回复
热议问题