【问题标题】:how to open a bitmap picture in gallery in android gallery如何在android画廊的画廊中打开位图图片
【发布时间】:2015-09-03 19:07:45
【问题描述】:

我想从数据库中获取image 并在gallery 或其他可以显示image 的应用程序中显示。如何为那个image设置uri??

我从数据库中得到这样的图像:

public Bitmap retrive(String table,String noeDastor,int row){
    Cursor cur=mydb.rawQuery("SELECT * FROM "+table+" where noeDastor= '"+noeDastor+"'", null);
    cur.moveToPosition(row);
    photo=cur.getBlob(5);
    ByteArrayInputStream imageStream = new ByteArrayInputStream(photo);
    Bitmap theImage= BitmapFactory.decodeStream(imageStream);
    return theImage;
}

我想在电话的gallery 中显示Image...

【问题讨论】:

  • 有没有试过的输出代码?

标签: android database image uri gallery


【解决方案1】:

尝试将位图保存到文件。然后在它所在位置的 Android 库中显示 如果我理解正确

当然,这是一个糟糕的解决方案,但它会起作用

或检查这些答案

How to get a Uri object from Bitmap

看起来他们使用类似的解决方案)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-06
    相关资源
    最近更新 更多