2016-09-26 130 views
0

我收到此錯誤信息AsyncHttpResponseHandler錯誤信息

Error:(137, 56) error: is not abstract and does not override abstract method onFailure(int,Header[],byte[],Throwable) in AsyncHttpResponseHandler

client.post("http://Your Ip Address or Localhost:8080/ImageUploadWebApp/uploading.jsp", 
      params, new AsyncHttpResponseHandler() { 
       @Override 
       public void onSuccess(String response) { 

        prgDialog.hide(); 
        Toast.makeText(getApplicationContext(), response, 
          Toast.LENGTH_LONG).show(); 
       } 


       @Override 
       public void onFailure(int statusCode, Throwable error, 
             String content) { 

        prgDialog.hide(); 

        if (statusCode == 404) { 
         Toast.makeText(getApplicationContext(), 
           "Requested resource not found", 
           Toast.LENGTH_LONG).show(); 

什麼是代碼的問題?

謝謝

+0

您的方法參數與抽象方法不同。 – James

回答

0

@詹姆斯是正確的,你的方法參數不正確,錯誤消息明確指出這一點。我不知道如何爲onSuccess獲取錯誤。

我猜你正在使用異步HTTP庫loopj

mClient.post(null, locationURL, se, "application/json", new AsyncHttpResponseHandler() { 
     @Override 
     public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { 

      AppLog.d("TAG", "Data post update success"); 

     } 
    @Override 
    public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { 
     AppLog.d("TAG", "Data post update failure"); 

    } 
    });