I am storing my images in drawable and their resource id in SQLite database.My database is created when the application starts for the first time.
Is it good to save
One approach would be storing the drawables in strings.xml as a string array something like this:
- @drawable/ic_image_name
- @drawable/ic_image_name
- @drawable/ic_image_name
- @drawable/ic_image_name
- @drawable/ic_image_name
- @drawable/ic_image_name
- @drawable/ic_image_name
Then reading this array in your activity code :
TypedArray locationFlags=getResources().obtainTypedArray(R.array.location_flags);
Then applying the for loop you can get the Drawable something like this:
for(int i=0i
Be sure to recycle the TypedArray after using it, since its a shared resource :
locationFlags.recycle();