2015. 8. 16. 23:01 IT/Android
1. execute 할때 error
Cannot execute task: the task has already been executed (a task can be executed only once)
라는 에러 생길 경우 한번 실행된것은 다시 execute 될 수 없기 때문에
task를 execute 할때마다 매번 new instance 한 후 execute한다.
2. return값 사용할 경우
1) public class MyAsyncTask extends AsyncTask<String, Void, Boolean> 처럼 마지막 파라미터에 return type 설정 후 doInBackground() 안에서 return 값 설정
2) execute.get() 해서 가져옴(대신 해당 thread에서 결과값 받아 온 후 main thread 실행 됨)
3. execute 시 파라미터 전달 하는 방법
예)
1) doInBackground(String... params){
String param1 = params[0];
String param2 = params[1];
2) 호출할 때는 execute("1", "2");
Failure [INSTALL_FAILED_OLDER_SDK] 해결 방법 (0) | 2015.08.27 |
---|---|
View의 Visibility 설정하기 (0) | 2015.08.04 |
Activity를 Dialog 형태로 띄우기 (0) | 2015.07.23 |
파일 업로드 위한 lib, 에러 (0) | 2015.07.13 |
Android Studio에서 lib 추가하기 (0) | 2015.07.13 |