Last active
December 29, 2015 18:39
-
-
Save a7madev/7711836 to your computer and use it in GitHub Desktop.
Get JSON Array from a webpage using Android Asynchronous Http Client http://loopj.com/android-async-http/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
RequestParams rParams = new RequestParams(); //if you have parameters to POST | |
rParams.put("example", "example"); //if you have parameters to POST | |
AsyncHttpClient client = new AsyncHttpClient(); | |
client.get(pageURL, rParams, new JsonHttpResponseHandler() { | |
@Override | |
public void onSuccess(JSONArray jsonArray) { | |
super.onSuccess(jsonArray); | |
//process JSON Array | |
} | |
@Override | |
public void onFailure(Throwable throwable, JSONArray jsonArray) { | |
super.onFailure(throwable, jsonArray); | |
Log.d(TAG, "onFailure", throwable); | |
} | |
}); | |
} catch (Exception e) { | |
Log.d(TAG, "Exception", e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment