2015-10-15 57 views
1

我使用android-async-http,並覆蓋所有onSuccessonFailure方法,但我得到了錯誤: onSuccess(int, Header[], JSONObject) was not overriden, but callback was received的onSuccess(INT,標題[]的JSONObject)沒有重寫,但回調收到

cz.msebera.android.httpclient.client.HttpResponseException: Not Found 

我只是想知道我真的重寫這個方法。 還有我的日誌:onSuccess JSONObject:{"error":null,"success":false}

public static void querySecurityCode(String username) { 
     RequestParams params = new RequestParams(); 
     params.put("username", username); 
     VStarRestClient.getClient().setEnableRedirects(true); 
     VStarRestClient.post(GET_SECURITY_CODE_URL, params, new JsonHttpResponseHandler(){ 
      @Override 
      public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 
       super.onSuccess(statusCode, headers, response); 
       Log.i("ws", "---->>onSuccess JSONObject:" + response); 
      } 

      @Override 
      public void onSuccess(int statusCode, Header[] headers, JSONArray response) { 
       super.onSuccess(statusCode, headers, response); 
       Log.i("ws", "---->>onSuccess JSONArray"); 
      } 

      @Override 
      public void onSuccess(int statusCode, Header[] headers, String responseString) { 
       super.onSuccess(statusCode, headers, responseString); 
       Log.i("ws", "---->>onSuccess responseString"); 
      } 


      @Override 
      public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { 
       super.onFailure(statusCode, headers, responseString, throwable); 
       Log.i("ws", "---->>onFailure:" + throwable.toString()); 
      } 

      @Override 
      public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 
       super.onFailure(statusCode, headers, throwable, errorResponse); 
       Log.i("ws", "---->>onFailure" + throwable.toString()); 
      } 

      @Override 
      public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) { 
       super.onFailure(statusCode, headers, throwable, errorResponse); 
       Log.i("ws", "---->>onFailure" + throwable.toString()); 
      } 


     }); 
    } 

回答

5

你不應該叫super.onFailuresuper.onSuccess,這一警告來自超級方法,當你沒有覆蓋他們。

0

試試這個線

public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 

System.out.println("Received event with data: " + response); 
}