Android Question View images from database using default image viewer

cbal03

Member
Licensed User
Longtime User
So far I can retrieve an image from the database and show it in an imageview. I would like to have the default image viewer display the image so that I can zoom and pan the image without writing the code myself. Can this be done without first writing the image to a file as the 'iIntent.Initialize() requires?
Thanks.

This is what I'm working with - once record is retrieved:
B4X:
        Dim csr As Cursor
        Dim Buffer() As Byte
        Dim imageData As image 'custom type

        imageData.Initialize
        imageData.rec_id = csr.GetString("id")
        imageData.wNum = csr.GetString("woNum")
        imageData.iName = csr.GetString("imageName")
        imageData.iData = csr.GetBlob("imageData")
        imageData.iText = csr.GetString("imageText")
        
        Buffer = imageData.iData
        
        Dim InputStream1 As InputStream
        InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
        
        Dim Bitmap1 As Bitmap
        Bitmap1.Initialize2(InputStream1)
        InputStream1.Close
        
        'intent requires a file - I'd like to provide image as a stream or bitmap etc..
        Dim iIntent As Intent
        iIntent.Initialize(iIntent.ACTION_VIEW,"file://" & File.Combine(File.DirRootExternal, "PF_Pic.jpg"))
        iIntent.SetType("image/jpeg")
        StartActivity(iIntent)
 
Top