How to store a simple read-only database in the Android app? -



How to store a simple read-only database in the Android app? -

i looking elegant solution next problem:

the application working on connects remote device , of course of study there may occur many different problems connection or remote device. each problem has own error code. when remote device reports issue, show description user, not error code. additional requirement description has localized.

my current solution simplest - there separate xml file in resources strings - error code name of string , description value.

to find description using next code:

try { description = getcontext().getresources().getstring(getcontext().getresources().getidentifier(item.geterrorid().touppercase(), "string", "com.mypackage")); } grab (notfoundexception e) { description = getcontext().getresources().getstring(r.string.description_not_available); }

i not solution, because pollutes strings namespace (there many possible issues), , uses exceptions catching.

is there better/standard way handle problem?

i assume aware of possibilities of handeling in android, can -

create sqlite database or, use external sqlite database save them in preferences.

but still suggest method have used far best case have. or allow me know issues facing suggest better.

android

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -