how can I change the card view clickable property from true to false at run time for example when the "A" radio button checked I want to display new items and clickable false, and when the "B" radio button checked I want to display new items with different number of items and clickable true. How can I implement this? I have tried this:
private void setUpDailyRecycleView(List<IWeather> dailyWeathers){
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.daily_recylceview);
CardAdapter cardAdapter = new CardAdapter(this, dailyWeathers);
CardView cardView = (CardView) findViewById(R.id.daily_card);
cardView.setClickable(true);
recyclerView.setAdapter(cardAdapter);
LinearLayoutManager verticalLayoutManger = new LinearLayoutManager(this);
verticalLayoutManger.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(verticalLayoutManger);
}
and this :
private void setUpDailyRecycleView(List<IWeather> dailyWeathers){
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.daily_recylceview);
CardAdapter cardAdapter = new CardAdapter(this, dailyWeathers);
recyclerView.setAdapter(cardAdapter);
LinearLayoutManager verticalLayoutManger = new LinearLayoutManager(this);
verticalLayoutManger.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(verticalLayoutManger);
CardView cardView = (CardView) findViewById(R.id.daily_card);
cardView.setClickable(true);
}
but a NullPointerException is thrown because the card view object is null.