android source

res > mipmap > filename 읽기

리오파파 2024. 12. 10. 13:18

 

Field[] fields = R.mipmap.class.getDeclaredFields();
int image_max = 0;

for (Field field : fields) {
    try {
        int resId = field.getInt(null);
        String resourceName = context.getResources().getResourceName(resId);
        if (resourceName.contains("i_")) {  // card image names are i_nnnn.png
            image_max++;
        }
    } catch (IllegalAccessException | Resources.NotFoundException e) {
        e.printStackTrace();
    }
}

'android source ' 카테고리의 다른 글

BlockedQue Operation  (1) 2025.03.18
내 앱이 화면 전면에 있나 확인하는 법  (0) 2025.02.25
TextView clicked animation  (0) 2024.12.03
textview touch color 변화  (0) 2024.10.24
Sound, media 대신 ring mode로 설정  (0) 2024.10.19