마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

AsyncTask 문법 질문입니다.

0 추천

안녕하세요. 

GCM관련해서 http://developer.android.com/google/gcm/gs.html 링크를 보고 작업을 진행하고 있는데요.

클라이언트에서 GCM을 사용하기 위해서 Project ID를 Registration하는 부분이 있는데..

관련 링크에서는 

new AsyncTask() {

     @Override

      protected String doInBackground(Void... params) {    }

}.execute(null ,null, null);

이런 형태로 사용하고 있는데요. 위와 같이 하니깐 

Multiple markers at this line
- AsyncTask is a raw type. References to generic type AsyncTask<Params,Progress,Result> should be arameterized
- The type new AsyncTask(){} must implement the inherited abstract method AsyncTask.doInBackground(Object...)
- Type safety: The method execute(Object...) belongs to the raw type AsyncTask. References to generic type AsyncTask<Params,Progress,Result> should be parameterized
 
이런 경고와 에러를 보내는데.. 어떻게 해야 하는 지를 잘 모르겠습니다.
 
대개는 
AsyncTask mTask = new AsyncTask<Params, Void, Result> {
 
};
mTask.execute();
이렇게 썼었는데 어떻게 바꿔줘야 되는지 도움 좀 부탁드립니다.
시베리아수컷타이거 (560 포인트) 님이 2013년 6월 13일 질문

1개의 답변

0 추천

AsyncTask<Params, Void, Result> mTask = new AsyncTask<Params, Void, Result> {

}

모든 파라메터가 null 이라면 <Void, Void, Void> 로 하시면 되겠네요.

동기화인생 (3,640 포인트) 님이 2013년 6월 13일 답변
아... 답변 감사드립니다. 별 거 아닌 것을 괜히 시간만 엄청 잡아먹었네요 ㅠ
...