Can i know what did i do wrong? i just wanna get my images from drawable folder and pass it to my adapter to display on my gridView.. But i dont know how to add inside the array.. The error message is at the line
arrImages[i] = this.getResources().getIdentifier(wd.getName(), "drawable", this.getPackageName());
Anybody wants to help me :( I wanna load it dynamically according to the names in my database.. the database name (wd.getName()) is the same as my file name.png
Declare at the top :
int arrImages [] = {};
Inside onCreate :
int i = 0;
for (Words wd : words)
{
String log = "Id: " + wd.getId() + " ,Name: " + wd.getName();
// Writing Contacts to log
Log.d("wordList : ", log);
arrImages[i] = this.getResources().getIdentifier(wd.getName(), "drawable", this.getPackageName());
i++;
}