Android Question How to save an image to Gallery?

Discussion in 'Android Questions' started by Riddle Ling, Aug 3, 2017.

  1. Riddle Ling

    Riddle Ling Member Licensed User

    How to save an image to Gallery?

    My code:
    Code:
    Dim Out As OutputStream
    Out = 
    File.OpenOutput(File.DirRootExternal, "Test.jpg"False)
    bitmap.WriteToStream(Out, 100"JPEG")
    Out.Close
    But did not appear in the Gallery app.
     
  2. DonManfred

    DonManfred Expert Licensed User

    Try this

    Code:
    Dim Out AsOutputStream
    Out = 
    File.OpenOutput(File.DirRootExternal, "Test.jpg"False)
    bitmap.WriteToStream(Out, 100"JPEG")
    Out.Close

    Dim i As Intent
    i.Initialize(
    "android.intent.action.MEDIA_SCANNER_SCAN_FILE", _
    "file://" & File.Combine(File.DirRootExternal, "Test.jpg"))
    Dim p As Phone
    p.SendBroadcastIntent(i)
     
    Douglas Farias, Matti81 and Erel like this.
  3. Riddle Ling

    Riddle Ling Member Licensed User

    Thank you!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice