0
我有點新至Android編程和不能似乎動搖了這個bug ..的AsyncTask混亂抽象
它告訴我:
The type LoginForm.login must implement the inherited abstract method AsyncTask<String,Void,String>.doInBackground(String...)
這是代碼:
private class login extends AsyncTask<String, Void, String> {
protected String doInBackground(String url) {
String response = "";
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse execute = client.execute(httpGet);
InputStream content = execute.getEntity().getContent();
BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
protected void onPostExecute(String result) {
int mId = 0;
//Close loading bar and text
login_form_loader.setVisibility(View.INVISIBLE);
warning.setText(result);
}
}
這是什麼意思,我該如何解決這個問題?
這偉大工程,但現在我得到的錯誤:構造HTTPGET(字符串[])未定義 – MichaelH
假設你只能傳遞一個字符串/只對第一個字符串感興趣,可以使用'new HttpGet(url [0]);' – assylias