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

相关内容

热门资讯

我来分享!掌中乐游戏中心吗(辅... 我来分享!掌中乐游戏中心吗(辅助挂)一贯存在有挂(2024已更新)(哔哩哔哩);1、掌中乐游戏中心吗...
wepok软件透明挂!wepo... wepok软件透明挂!wepoke可以来好牌(透明挂)wepoKe(原来真的有挂)准备好在wepoK...
微扑克wpk透视辅助!微扑克职... 微扑克wpk透视辅助!微扑克职业代打,微扑克app(确实有挂辅助挂)1、快速入门:当你通过点击开始按...
重磅来袭!心动麻将有挂么(透视... 重磅来袭!心动麻将有挂么(透视)一贯真的是有挂(2022已更新)(哔哩哔哩)1、起透看视 心动麻将有...
微扑克ai辅助工具!微扑克线上... 微扑克ai辅助工具!微扑克线上代打,WPK果然存在有挂,教你教程(有挂软件)是一款可以让一直输的玩家...
wepokeai代打!wepo... wepokeai代打!wepower插件(辅助透视)Wepoke(都是真的有挂);是一款可以让一直输...
教程辅助!越乡游斗地主有挂吗(... 教程辅助!越乡游斗地主有挂吗(辅助)原来有挂(2026已更新)(哔哩哔哩)1、很好的工具软件,可以解...
微扑克有辅助挂!微扑克有脚本,... 微扑克有辅助挂!微扑克有脚本,微扑克有辅助挂,解密教程(有挂方法)1、每一步都需要思考,不同水平的挑...
aapoker透明挂!wepo... aapoker透明挂!wepoke是机器发牌,wepoKe果然真的有挂,规律教程(有挂详情)这是由厦...
玩家科普!开心十三张辅助ios... 玩家科普!开心十三张辅助ios版(辅助挂)其实是真的有挂(2026已更新)(哔哩哔哩)1、开心十三张...