0

我对android编程有点陌生,似乎无法摆脱这个错误..

它告诉我:

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);

      }
    }

这到底是什么意思,我该如何解决这个问题?

4

2 回答 2

3

您需要将方法签名更改为:

protected String doInBackground(String... url)

(为了清楚起见,您也应该在该方法上添加@Override注释)。

于 2012-12-05T11:23:52.303 回答
0

doinbackground 函数在您的情况下应该是这样的

   @Override
    protected Result doInBackground(String... params) {
        // TODO Your code here
        return null;
   }
于 2012-12-05T11:26:12.140 回答