Android13读取媒体图片权限无效的问题
创始人
2024-10-01 00:01:33
0

解决方法:在AndroidManifest.xml文件中添加读取外部存储权限,并调用MediaStore.Images.Media.EXTERNAL_CONTENT_URI来获取媒体图片。代码示例:

//在AndroidManifest.xml文件中添加读取外部存储权限


//调用MediaStore.Images.Media.EXTERNAL_CONTENT_URI来获取媒体图片
String[] projection = {MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
if (cursor != null) {
    while (cursor.moveToNext()) {
        long imageId = cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID));
        String imagePath = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
        Log.d("imagePath", "id: " + imageId + ", path: " + imagePath);
    }
    cursor.close();
}

相关内容

热门资讯

正品透视"wepok... 正品透视"wepoker开挂辅助挂教程"开挂(透视)辅助挂(玩家必看科普规律教程)正品透视"wepo...
曝光透视"WePok... 曝光透视"WePoker辅助挂教程"开挂(透视)辅助挂(终于懂了解密教程)《曝光透视"WePoker...
原来有透视"wepo... 原来有透视"wepokerplus有没有挂"开挂(透视)辅助神器(详细说明解密教程)原来有透视"we...
正品透视"WePok... 正品透视"WePoker德州开挂神器透视"开挂(透视)辅助平台(一分钟了解科技教程)正品透视"WeP...
科技透视"wepok... 科技透视"wepoker真的有透视挂么"开挂(透视)辅助工具(免费测试版安装教程)科技透视"wepo...
实测透视"微扑克发牌... 实测透视"微扑克发牌真的很假"开挂(透视)辅助插件(实操分享透明教程)实测透视"微扑克发牌真的很假"...
传授透视"WePok... 传授透视"WePoker透视插件怎么安装"开挂(透视)辅助器(2026教程必胜教程)传授透视"WeP...
实测透视"wepok... 实测透视"wepoker有挂吗开挂"开挂(透视)辅助插件(一分钟了解专业教程)实测透视"wepoke...
科技透视"wepok... 科技透视"wepokerplus透视挂真的假的"开挂(透视)辅助工具(必知教程可靠教程)【福星临门,...
分析透视"wepok... 分析透视"wepoker透视真的吗"开挂(透视)辅助工具(重大消息微扑克教程)分析透视"wepoke...