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

相关内容

热门资讯

必备透视!德州透视是真的假的,... 您好,德州透视是真的假的这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054】很多...
解迷透视!wpk德州局怎么透视... 解迷透视!wpk德州局怎么透视,微信微乐游戏辅助脚本,项目教程(讲解有挂)-哔哩哔哩wpk德州局怎么...
解密透视!wepoker养号规... 解密透视!wepoker养号规律,微乐南昌辅助神器,资料教程(有挂秘籍)-哔哩哔哩运wepoker养...
详细透视!wepoker国外版... 详细透视!wepoker国外版透视,微信微乐辅助ios,大纲教程(有挂神器)-哔哩哔哩1、wepok...
必备透视!大菠萝辅助器,微乐小... 必备透视!大菠萝辅助器,微乐小程序礼包码,烘培教程(有挂解密)-哔哩哔哩1、实时大菠萝辅助器透视辅助...
关于透视!拱趴大菠萝开挂方法,... 关于透视!拱趴大菠萝开挂方法,微信小程序游戏破解微乐辅助,举措教程(真的有挂)-哔哩哔哩1、完成拱趴...
普及透视!wepoker插件程... 普及透视!wepoker插件程序激活码,微乐麻将自建房app,策略教程(有挂技术)-哔哩哔哩wepo...
必备透视!德州私人局脚本,微乐... 必备透视!德州私人局脚本,微乐自建房辅助工具在哪,教程书教程(的确有挂)-哔哩哔哩1、首先打开德州私...
必备透视!aapoker发牌逻... 必备透视!aapoker发牌逻辑,微乐科技软件下载,妙招教程(有挂规律)-哔哩哔哩aapoker发牌...
了解透视!wepoker怎么破... 了解透视!wepoker怎么破解游戏,微乐自建房脚本使用安全吗,机巧教程(有挂分享)-哔哩哔哩运we...