Created
January 15, 2016 16:20
-
-
Save shelajev/b26ebc569bc8ea6b3666 to your computer and use it in GitHub Desktop.
retrofit2-NetworkCall.java
This file contains hidden or 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
| 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