Skip to content

Instantly share code, notes, and snippets.

@shelajev
Created January 15, 2016 16:20
Show Gist options
  • Select an option

  • Save shelajev/b26ebc569bc8ea6b3666 to your computer and use it in GitHub Desktop.

Select an option

Save shelajev/b26ebc569bc8ea6b3666 to your computer and use it in GitHub Desktop.
retrofit2-NetworkCall.java
private class NetworkCall extends AsyncTask<Call, Void, String> {
@Override
protected String doInBackground(Call… params) {
try {
Call<List<Contributor>> call = params[0];
Response<List<Contributor>> response = call.execute();
return response.body().toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
final TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment