title: onSuccess - Asynchronous Http Client
body: <p>I'm using the <a href="http://loopj.com/android-async-http/" rel="nofollow">Android Asynchronous Http Client</a>. My code looks like this and is working fine.</p>
  
  <pre><code>    DataUtil.post("RegisterUser", params, new AsyncHttpResponseHandler() {
              @Override
          public void onSuccess(String answer) {              
              // initialize variables
              JSONObject json = new JSONObject();
              String message = null;
  
              try {
                  // turn string into JSONObject
                  json = new JSONObject(answer);
                  message = json.getString("message");
              } catch (JSONException e) {
                  Log.e("ERROR", e.getMessage());
              }
  
              // registration was successful
              if (message.equals("success")) {
                  // forward to login page      
              } else {
              // error
              }
          }
      });
  </code></pre>
  
  <p>I implemented a <a href="http://loopj.com/android-async-http/#recommended-usage-make-a-static-http-client" rel="nofollow">static HTTP Client</a>. My server returns this JSON data <code>{"message":"success"}</code>. I do not want to treat it as a String and cast it back to JSON. But when I change it to <code>public void onSuccess(JSONObject answer)</code> eclipse tells me </p>
  
  <blockquote>
    <p>The method onSuccess(JSONObject) of type new
    AsyncHttpResponseHandler(){} must override or implement a supertype
    method</p>
  </blockquote>