android - What is the best way to keep a list of references to drawables? -
any user of app can create new "subject" , select icon (from icon set define/provide). there imagebutton
presents selected icon or default icon, , when user clicks on it, popup gridview in opens, allowing user change icon whatever icon finds nice.
to need array or list of icons available selection in order make grid view out of them.
the best solution can think of creating global array/list of strings referring icons, i'm not sure how of solution is.
using database bad option since takes time re-query every time need use icon , it's not efficient.
another option of drawables folder array, unwanted drawables may included.
so question best way of doing it?
i handled in 1 of apps naming each icon , giving number. image1.png, image2.png etc
i use retrieve image want.
public drawable geticon(context c, integer imageid) { return c.getresources().getdrawable(c.getresources().getidentifier("image" + integer.tostring(imageid), "drawable", c.getpackagename())); }
this way ever need know index of drawable want.
Comments
Post a Comment