3

我想知道是否可以在这样的资源数组中确定android资源类型(如drawable,raw):

public static final int[] resourcesArray = {
R.drawable.image1,
R.raw.image2,
R.drawable.image3
};
4

1 回答 1

10

尝试

Resources resources = context.getResources();
String res = resources.getResourceTypeName(resid);
if (res.equals("drawable")){
    ....
}
于 2013-09-16T13:53:54.380 回答