开发者

android drawable identifier in a database

开发者 https://www.devze.com 2023-04-02 17:47 出处:网络
what is the best way to store a drawable identifier in a database? by is id? but i开发者_StackOverflowf it is generated it can change, what to do? I\'ve been looking arround but can\'t find complete i

what is the best way to store a drawable identifier in a database? by is id? but i开发者_StackOverflowf it is generated it can change, what to do? I've been looking arround but can't find complete information about it.


Why would you want to store drawable in database , you can simply create a Integer[] array containing all the ids from R.java class

like

Integer[] myDrawables = new Integer[]{
R.drawable.xdrawable,
R.drawable.ydrawable,
R.drawable.zdrawable,
}

now to access them becomes much easier. I usually define them in public static scope to make them accessible from anywhere

0

精彩评论

暂无评论...
验证码 换一张
取 消