Are there constants for the various resource types (ie: "drawable") in Android?
I want to code some conditional logic based on the return value of getResourceTypeName and I would prefer to avoid hardcoding the resource types.
Example:
final String type = context.getResources().getResourceTypeName(resid);
if ("drawable".equalsIgnoreCase(type)) {
// Something
} else if ("xml".equalsIgnoreCase(type)) {
// Something else
}
// TODO: Replace above strings with system constants
(I can create my own c开发者_运维技巧onstants, obviously, but I would prefer to use system constants to ensure upward compatibility)
It seems to be hardcoded:
http://codesearch.google.com/codesearch?q=\%22drawable\%22+\%22xml\%22&exact_package=git://android.git.kernel.org/platform/frameworks/base.git
精彩评论