title: asynchttpclient OnSuccess method gives response after activity is finished
body: <p>I am facing some difficulty in my code. I am initializing my drawer from json response, but my 'OnSuccess' method gives response when my activity gets over. 
  also if I initialized arraylist in OnSuccess It still gives empty in OnCreate method because OnSuccess method gives response when activity is finished. </p>
  
  <p>Please can anybody help me.</p>
  
  <p>Here is a sample code.</p>
  
  <pre><code>    @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      // Indicate that this fragment would like to influence the set of actions in the action bar.
      setHasOptionsMenu(true);
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      mDrawerListView = (ListView) inflater.inflate(
              R.layout.fragment_navigation_drawer, container, false);
      mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              selectItem(position);
          }
      });
      AsyncHttpClient client=new AsyncHttpClient();
      client.addHeader("X-Oc-Merchant-Id", "123");
      client.addHeader("X-Oc-Merchant-Language", "en");
      client.get("http://webshop.opencart-api.com/api/rest/categories", new AsyncHttpResponseHandler() {
          public static final String TAG = "";
  
          @Override
          public void onSuccess(String response) {
              // Log.i(TAG,"resp= "+response);
              try {
                  JSONObject resp = new JSONObject(response);
                  if (resp.getString("success").equals("true")) {
                      JSONArray array = resp.getJSONArray("data");
                      cat_count = array.length();
                      for (int i = 0; i &lt; array.length(); i++) {
                          JSONObject ArrObj = array.getJSONObject(i);
                          category.add(ArrObj.getString("name"));
                          category_id.add(ArrObj.getString("category_id"));
                      }
  
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
  
              mDrawerListView.setAdapter(new ArrayAdapter&lt;String&gt;(
                      getActionBar().getThemedContext(),
                      android.R.layout.simple_list_item_activated_1,
                      android.R.id.text1,
  
                      new String[]{
                              //getString(R.string.title_section1),
                              //getString(R.string.title_section2),
                              //getString(R.string.title_section3),
                              category.get(0),
                              category.get(1).replaceAll("&amp;amp;","&amp;"),
                              category.get(2),
                              category.get(3),
                              category.get(4),
                              category.get(5).replaceAll("&amp;amp;","&amp;"),
                              category.get(6),
                              category.get(7),
                      }));
              mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
          }
      });
  
  
      return mDrawerListView;
  }
  </code></pre>