0
点赞
收藏
分享

微信扫一扫

根据id名称获取id

zidea 2023-03-16 阅读 94


// 获取从adbox_1到adbox_64的图片
private int getPicId() {

int randomNum = new Random().nextInt(64) + 1;
int notFoundResId = getResources().getIdentifier("adbox_" + randomNum, "mipmap", getContext().getPackageName());
return notFoundResId;

}



举报

相关推荐

0 条评论