Android模拟器中的照片文件
创始人
2024-10-09 08:01:12
0

在Android模拟器中,可以通过使用MediaStore来访问照片文件。以下是一个简单的示例,演示如何从MediaStore中检索所有相册并显示它们的照片。

// Define a projection that specifies the columns from the table we care about.
String[] projection = {
        MediaStore.Images.Media._ID,
        MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
        MediaStore.Images.Media.DATE_TAKEN,
        MediaStore.Images.Media.DATA
};

// Get the base URI for the People table in the Contacts content provider.
Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;

// Make the query.
Cursor cur = getContentResolver().query(images,
        projection, // Which columns to return
        null,       // Which rows to return (all rows)
        null,       // Selection arguments (none)
        null        // Ordering
);

if (cur.moveToFirst()) {
    String bucketName;
    String dateTaken;
    String path;
    int bucketColumn = cur.getColumnIndex(
        MediaStore.Images.Media.BUCKET_DISPLAY_NAME);

    int dateColumn = cur.getColumnIndex(
        MediaStore.Images.Media.DATE_TAKEN);

    int dataColumn = cur.getColumnIndex(
        MediaStore.Images.Media.DATA);

    do {
        // Get the field values
        bucketName = cur.getString(bucketColumn);
        dateTaken = cur.getString(dateColumn);
        path = cur.getString(dataColumn);

        // Do something with the values.
        Log.v(TAG, "Bucket Name: " + bucketName +
            " Date Taken: " + dateTaken +
            " Path: " + path);
    } while (cur.moveToNext());
}

相关内容

热门资讯

推荐透视!wepoker分析,... 推荐透视!wepoker分析,小程序微乐辅助器2.0,项目教程(有挂头条)-哔哩哔哩1、许多玩家不知...
曝光透视!德普之星透视软件免费... 曝光透视!德普之星透视软件免费入口官网,微乐自建房安装挂,法门教程(真实有挂)-哔哩哔哩德普之星透视...
解密透视!wepoker作弊方... 解密透视!wepoker作弊方法,微乐麻将脚本透视,步骤教程(有挂头条)-哔哩哔哩1、玩家可以在we...
必备透视!wepoker买钻石... 必备透视!wepoker买钻石有用吗,微乐如何自己建脚本,方案教程(有挂方略)-哔哩哔哩1、wepo...
了解透视!wejoker辅助脚... 了解透视!wejoker辅助脚本,微信小程序游戏辅助,要领教程(确实有挂)-哔哩哔哩;1、wejok...
解迷透视!德扑圈透视,微信小程... 解迷透视!德扑圈透视,微信小程序微乐游戏修改器,积累教程(有挂透视)-哔哩哔哩1、让任何用户在无需德...
辅助透视!wpk辅助软件,微乐... 辅助透视!wpk辅助软件,微乐自建房黑科技入口在哪,经验教程(有挂工具)-哔哩哔哩1、在wpk辅助软...
辅助透视!hhpoker辅助软... 辅助透视!hhpoker辅助软件下载,微乐小程序自建房透视,绝活儿教程(真实有挂)-哔哩哔哩进入游戏...
总结透视!wepoker的辅助... 总结透视!wepoker的辅助器,微乐小程序辅助器代理,模块教程(有挂教程)-哔哩哔哩1)wepok...
总结透视!hhpoker一直输... 总结透视!hhpoker一直输有挂吗,微乐游戏小程序脚本,方式教程(有挂方法)-哔哩哔哩1、每一步都...