0
我的異步方法是給編譯器error.This是我的代碼:的Android異步任務編譯器錯誤
private void registerInBackground() {
new AsyncTask() {
@Override
protected String doInBackground(Void... params) {
}
@Override
protected void onPostExecute(String msg) {
}
}.execute(null, null, null);
}
對於線2我收到此錯誤:
Multiple markers at this line
- 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 is a raw type. References to generic type AsyncTask<Params,Progress,Result> should be parameterized
對於4號線我得到此錯誤:
The method doInBackground(Void...) of type new AsyncTask(){} must override or implement a supertype method
我該如何解決它們?我的代碼有什麼問題?