0

I want to get an image from database and show that in gallery or other apps that can show an image. How can set a uri for that image??

I get a image from database like this :

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

And I want show the Image in gallery of phone...

Shivam Kumar
  • 1,892
  • 2
  • 21
  • 33
shayan talaei
  • 21
  • 1
  • 7

1 Answers1

0

Try to save bitmap to file. And then show in Android gallery where it has the location if i right understand

It is a bad solution, of course, but it will work

Or check these answers

How to get a Uri object from Bitmap

It looks like they use similar solution)

Community
  • 1
  • 1
Vlad
  • 7,997
  • 3
  • 56
  • 43