TinyDB--Android-Shared-Preferences-Turbo
TinyDB--Android-Shared-Preferences-Turbo copied to clipboard
java.lang.NullPointerException: listFood.get(0) must not be null
fun insertFood(item: FoodDomain){
listFood = tinyDB.getListObject("CartList")
listFood.add(item)
tinyDB.putListObject("CartList",listFood)
var fod : FoodDomain = listFood.get(0)
}
The error is: when i get the list, it have size, 1 or 2 or 3 , is normal; but if i want get one object of the list, it say "must not be null"
like IS A LIST WITH SIZE BUT ALL OBJECT ARE NULL OR NOT EXIST ? please help :c i have this problem 2 months
Hello, can you share the error log for the crash? it will help me find out what the problem is and how to solve it.