Android Question db Blob needs a filename-Solved

anOparator

Active Member
Licensed User
Longtime User
This code gives warnings but no errors and no file on the SD card. Would you tell me what's incorrect please.
B4X:
Sub prnt2
Dim Cursor3 As Cursor = SQL1.ExecQuery("select image FROM MyTable WHERE name = name")
  Cursor3.Position = pos
  Dim Bmp As Bitmap             ' I added this
     If Cursor3.RowCount > pos Then
  Dim binImage() As Byte, Flux As InputStream
  binImage = Cursor3.GetBlob("Image")
  Flux.InitializeFromBytesArray(binImage, 0, binImage.Length)
  Bmp.Initialize2(Flux)
  Flux.Close
  End If
  Cursor3.Close
  Return Bmp         ' Warning Object converted to String
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "0.png" , True)  ' Unreachable code
out.WriteBytes(binImage, 0, binImage.Length)
out.Cl
End Sub
Thanks for all pointers.
 

anOparator

Active Member
Licensed User
Longtime User
Thanks , now I know I am reading the code well.

Yes it was out.Close yet I get same results with that line commented.
Here's my practice project.
 

Attachments

  • tmp_blobFile1916942465.zip
    40.9 KB · Views: 164
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
OK , I enable FirstTime True and it showed up once on Internal storage.

Using a MotoE from a AMD Phenom and not getting consistent results,

The file has never appeared on DirRootExternal.

Am going to run this on my old reliable laptop tomorrow. Thanks.
 
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
You only need to initialize SQL when FirstTime is true.
How do you see that the file was not created?
Thanks , I put a File Explorer on my no-service phone and see the files, in lieu of extra code for Windows Explorer.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…