Saving resources path in SQLite

前端 未结 1 983
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 08:27

I need to save the images in my resource folder in an SQLite database. This database is pre-loaded(copied to data/ path) so the there is no populating at runtime. I\'ve trie

1条回答
  •  执念已碎
    2021-01-03 09:02

    If you have the name of the resource you can lookup the resource identifier and use that for your ImageResource.

    int resId = context.getResources().getIdentifier("picture1","drawable",context.getPackageName());
    image.setImageResource(resId);;
    

    0 讨论(0)
提交回复
热议问题