خرید بک لینک

Vote count: 0

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

asked 26 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 13 اسفند 1394 ساعت: 12:56

صفحه بندی