Android drawables : Is there any way to somehow link the int IDs to the R drawable IDs? -
i have 718 drawables in drawable-mdpi
, drawable-hdpi
and drawable-xhdpi
folders, names 1.png, 2.png... 718.png. (they pokémon sprites)
so, depending on pokémon, want load 1 of them show it. however, cannot use number directly identify r drawable id.
is there way (besides of 718-case switch or hashmap<integer,integer>
) somehow link int ids r drawable ids?
you try:
string sprite = "drawable/"+number; int imageresource = getresources().getidentifier(sprite, null, getpackagename());
the drawable
folder image in. number
number of image want. e.g. 1.png
Comments
Post a Comment