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());
}

相关内容

热门资讯

重磅来袭!hhpoker辅助,... 重磅来袭!hhpoker辅助,佛手在线大菠萝为什么都输,一直有挂(有挂方针)1、任何透视是真的假的的...
一起来讨论!wepokerpl... 一起来讨论!wepokerplus外挂,wepoker透视版下载,本来是真的有挂(真的有挂)1)有没...
揭秘几款!wepoker透视脚... 揭秘几款!wepoker透视脚本免费使用视频,wepoker黑侠破解,确实存在有挂(存在有挂)进入游...
如何分辨真伪!hhpoker德... 如何分辨真伪!hhpoker德州挂真的有吗,福建大菠萝万能辅助器,切实是有挂(有挂技术)1、全新机制...
玩家必看教程!wepoker透... 玩家必看教程!wepoker透视脚本下载,aapoker辅助工具安全吗,切实真的有挂(有挂助手)1、...
推荐十款!aapoker怎么设... 推荐十款!aapoker怎么设置提高好牌几率,德州真人透视脚本,一贯有挂(有挂细节)1、进入到是否有...
玩家必看!德普之星辅助软件,德... 玩家必看!德普之星辅助软件,德州透视插件,好像是真的有挂(发现有挂)1、金币登录送、破产送、升级送、...
重磅来袭!pokemmo手机版... 重磅来袭!pokemmo手机版脚本,德州透视是真的吗,其实真的是有挂(有挂方法)重磅来袭!pokem...
揭秘!wepoker透视破解版... 揭秘!wepoker透视破解版,wepoker模拟器哪个好用,好像真的是有挂(有挂技巧)1、完成有辅...
玩家交流!hhpoker必备开... 玩家交流!hhpoker必备开挂,aapoker辅助怎么用,果然真的有挂(有挂详细)1、破解器简单,...