My class extends RecyclerView.Adapter<...>
@Override
public int getItemCount() {
retu arrayListPacks == null ? 0 : arrayListPacks.size();
// retu 5;
}
To get only 5 records in an ArrayList, I have used:
retu 5;
But, I am getting NullPointer exception, when there is no record found.
So, How could I handle this exception ?
I would like to show maximum 5 records if exist(s) else handle NPE
