Hi I am working on a application where I need to display bunch of images for some conditions. Is th开发者_如何学Pythonere any simpler way to get all images without mentioning the resource names as in Android platform like
int id = getResources().getIdentifier(imgName, "drawable",
getPackageName());
Please anybody help me in this regard.Thanks in advance.
I think you don't want to hard code image names. So you can use ResourceBundle.
static ResourceBundle _resources=ResourceBundle.getBundle(MyAppResourcesResource.BUNDLE_ID, MyAppResourcesResource.BUNDLE_NAME);
Bitmap bitmap = Bitmap.getBitmapResource(_resources.getString(MyAppResourcesResource.IMAGE_NAME));
For details of ResourceBundle read this article.
Localizing an application
精彩评论