retrofit recyclerview code example
Example: set recyclerview adapter using retrofit in android studio
recyclerView = (RecyclerView)findViewById(R.id.recyclerview); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); recyclerAdapter = new RecyclerAdapter(getApplicationContext(),movieList); recyclerView.setAdapter(recyclerAdapter); ApiInterface apiService = ApiClient.getClient().create(ApiInterface.class); Call<List<Movie>> call = apiService.getMovies(); call.enqueue(new Callback<List<Movie>>() { @Override public void onResponse(Call<List<Movie>> call, Response<List<Movie>> response) { movieList = response.body(); Log.d("TAG","Response = "+movieList); recyclerAdapter.setMovieList(movieList); } @Override public void onFailure(Call<List<Movie>> call, Throwable t) { Log.d("TAG","Response = "+t.toString()); } });