Android.os.AsyncTask
AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.
AsyncTask는 handler와 thread 사용을 편리하게 사용하기 위해 만들어진 클래스이다. 한 클래스 안에서 Ui작업과 비즈니스 로직 처리가 모두 가능하기 때문에 간편하다. 사용예는 다운로드나 로그인, 등등 UI와 로직이 같이 실행되야 되는 부분은 거의 모두 AsyncTask를 사용한다고 보면 된다.
AsyncTask 템플릿 파라미터 설명
AsyncTask<type1, type2, type3>
- type1:
doInBackground()
의 parameter type. - type2:
onProgressUpdate()
의 parameter type. - type3:
onPostExecute()
의 parameter type.
Download
- Com.zekiplay.android.app.util.AsyncDownload.zip (2014-02-14)
- 웹상의 데이터를 다운로드할 수 있도록 도와주는 AsyncDownload 클래스.
Favorite site
- Developer android: AsyncTask class reference
- 안드로이드 AsyncTask 사용하는 방법
- AsyncTask 쓰레드 우선순위 조절하기
- AsyncTask 사용하기
- Android ExceptionInInitializerError when using AsyncTask (Async 비동기 통신을 사용할 때 비동기 통신 안에서 생성을 안할 경우 위와 같은 에러가 생긴다)
- AsyncTask에서 cancel 처리 예제