Skip to content

Instantly share code, notes, and snippets.

@codemilli
Created January 30, 2016 12:26
Show Gist options
  • Save codemilli/ea04430d7a166da1c8ac to your computer and use it in GitHub Desktop.
Save codemilli/ea04430d7a166da1c8ac to your computer and use it in GitHub Desktop.
Async Task with JSON Api request
private class RestApi extends AsyncTask<String, Void, JSONObject> {
@Override
protected JSONObject doInBackground(String... params) {
return this.GET(params[0]);
}
@Override
protected void onPostExecute(JSONObject jsonObject) {
super.onPostExecute(jsonObject);
this.onReceived(jsonObject);
}
protected abstract void onReceived(JSONObject json);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment