android drawable identifier in a database
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
精彩评论