Create an appropriate array and assign it to the id variable.I am using the tutorial on AndroidHive for expandablelistview and i want to populate it from a sqlite table. Yup, that can null because you assign it to null, and it will never be anything but null since you never assign any other value to it. Id=getResources().getIdentifier(str, "drawable", getPackageName()) ![]() I am not sure if str can be null (I would have to read your datamanager class I think, but for id: This leaves the id array and the str array. There are a couple of objects used on that line, but the system ones (the Resources and package name) can't be null. Line 41 looks like this: id=getResources().getIdentifier(str, "drawable", getPackageName()). ![]() The problem is on line 41 of the MainActivity class, in the getID() method. ![]() In your case, we can find out where using the stack trace: 11 moreĪs always, a NullPointerException is being thrown because you are using an variable which doesn't point to an object - it instead has a null value. I am using this tutorial for creating a custom listview from the database īut i modified the mainactivity such that the names and the image id's are retrieved from the database
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |