문제

AsynchTask got onPostExecute() method tied to UI thread. Assume that we close an activity by pressing back button while AsynchTask doInBackground() method is still in progress.

  1. I want to know will onPostExecute executes by considering that activity is not displaying on screen anymore?
  2. In case answer is yest, will it cause exceptions or not? (because of accessing UI objects which are not longer displayed on screen).
도움이 되었습니까?

해결책

1-I want to know will onPostExecute executes by considering that activity is not displaying on screen anymore?

yes!

2-In case answer is yest, will it cause exceptions or not? (because of accessing UI objects which are not longer displayed on screen).

Yes! it may cause Exception because your Instance of your Activity and Views which you use in your AsyncTask are not exist anymore

This Link will help you more : AsyncTask won't stop even when the activity has destroyed

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top