Last active
January 11, 2020 06:15
-
-
Save shikto1/936aa030e2469f610575dab30299f61b to your computer and use it in GitHub Desktop.
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
public class MoviesActivity extends Activity { | |
private TextView mNoOfMoviesThisWeek; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.layout_movies_activity); | |
mNoOfMoviesThisWeek = (TextView) findViewById(R.id.no_of_movies_text_view); | |
MoviesRepository repository = ((MoviesApp) getApplication()).getRepository(); | |
repository.getMoviesThisWeek() | |
.enqueue(new Callback<List<Movie>>() { | |
@Override | |
public void onResponse(Call<List<Movie>> call, | |
Response<List<Movie>> response) { | |
int numberOfMovies = response.body().size(); | |
mNoOfMoviesThisWeek.setText("No of movies this week: " + String.valueOf(numberOfMovies)); | |
} | |
@Override | |
public void onFailure(Call<List<Movie>> call, Throwable t) { | |
// Oops. | |
} | |
}); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment