I have in my database a column that stores the filename of the images I'm using in the android application. In most of my activities I need to use a lot of these images.
So I store these filenames in an ArrayList<String>
and I want for my output to be an ArrayList<Integer>
of Resources IDs of these images.
Based on several questions here on stackoverflow, I used the following technique (got it from this question) :
// Where tileImageFilenames is the ArrayList<String>
for(int i=0;i<tileImagesFilename.size();i++)
{
tileImagesIDS.add(getResources().getIdentifier(tileImagesFilename.get(i) , "drawable", getApplication().getPackageName()));
}
This returns me an ArrayList<Integer>
full of 0s.