android - Static reference to images file in my Database -


let's want create database static references images included in android app. if use drawable folder, ids dynamic , can't use static reference them.

since want use 1 column of database resource suggestion icons in app, using drawables files not simple...

if want it, in folder should put .png files? , in database, url should save each entry?

it's pretty simple use in normal drawable folders , write in db string/text.

the resources object have few methods deal it:

getidentifier(...) use integer id of drawable, example:

context.getresources().getidentifier("icon", "drawable", context.getpackagename()); 

and getresourceentryname(...) use string name of drawable, example:

context.getresourceentryname(r.drawable.icon); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -