随心-1030 2023-02-09 17:31 采纳率: 33.3%
浏览 12
已结题

读取多个彩信图片附件,如何读取第二个图片附件?

读取多个彩信图片附件,如何读取 第二 / N多 个图片附件?
大概代码:
cPart = context.getContentResolver().query("content://mms/part", null, "mid=827" , null, null);
coloumns = cPart.getColumnNames();
String[] values= new String[coloumns.length];

for (int i = 0; i < cPart.getColumnCount(); i++) {
     values[i] = cPart.getString(i);
 }

if (values[3].equals("image/jpeg"){
getVideo(values[0]);
 }

//读取视频/音频/图片
    private byte[] getVideo(String _id) {
        Uri partURI = Uri.parse("content://mms/part/" + _id);
        InputStream inputStream = null;
        byte[] ret = new byte[0];
        try {
            inputStream = context.getContentResolver().openInputStream(partURI);
            if (inputStream != null)
                ret = InputStreamToByteArray(inputStream);
        } catch (FileNotFoundException e) {
            Log.v("==" + e.getMessage());
        } 
        return ret;
    }
我只拿到了首个图片,如何继续拿到另一个,还是说图片其实是全部拿到了的?
  • 写回答

1条回答 默认 最新

  • Halifax ‎ 2023-02-09 17:54
    关注

    你判断 values 的长度,像下面这样取:
    getVideo(values[1])
    getVideo(values[2])

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 2月10日
  • 已采纳回答 2月10日
  • 创建了问题 2月9日

悬赏问题

  • ¥15 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败