Skip to content

Instantly share code, notes, and snippets.

@alvinsj
Last active December 30, 2015 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvinsj/7823790 to your computer and use it in GitHub Desktop.
Save alvinsj/7823790 to your computer and use it in GitHub Desktop.
new APIRequest( new APIClient(HomeActivity.this), APP_SERVER+"/search", APIRequest.GET)
.withDefaultParams(defaultParamsHashMap())
.addParam("format", "json")
.addParam("q", searchTerm)
.addHeaderParam("Referer", APP_REFERER);
.start(new JSONRequestHandler(){
@Override
public void before(){
showProgressBar();
}
@Override
public void after(){
updateView();
hideProgressBar();
}
@Override
public void onException(Exception e) {
e.printStackTrace();
}
@Override
public void onResponse(HttpEntity response, JSONObject jsonResponse) {
createModelFromResponse(jsonResponse)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment