I'd like to search using invoice number but it's give an error in Invoice no how to solve it. here is my filter method & error is:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase(java.util.Locale)' on a null object reference
public void filter(String charText) {
charText = charText.toLowerCase(Locale.getDefault());
billmod.clear();
if (charText.length() == 0) {
billmod.addAll(arraylist);
} else {
for (BillModel st : arraylist) {
if (st.getBill_tableno().toLowerCase(Locale.getDefault()).contains(charText)) {
billmod.add(st);
}
else if(st.getBill_date().toLowerCase(Locale.getDefault()).contains(charText)) {
billmod.add(st);
} else if(st.getBill_amount().toLowerCase(Locale.getDefault()).contains(charText)) {
billmod.add(st);
}
else if(st.getIncvoice_no().toLowerCase(Locale.getDefault()).contains(charText)) {
billmod.add(st);
}
}
}
notifyDataSetChanged();
}