The output is not saved !!!

danoptic

Member
Licensed User
Longtime User
After I save the new picture, I can't find it?
Why doesnt it save the file?


I copied the relevant lines

Thanks

Sub
Globals
Dim pnlMain, pnlSplash AsPanelDim amslerBitmap AsBitmap
Dim canvas1 AsCanvasEnd Sub
'''''''
Sub Activity_Create(FirstTime AsBoolean)
amslerBitmap.Initialize(File.DirAssets, "originPic.png")
Activity.LoadLayout(
"main.bal")
canvas1.Initialize(pnlMain)

''''''''''''
sub SaveNew
Dim out AsOutputStream
DateTime.DateFormat = "ddMMyy"
Dim Bitmap1 AsBitmap
Dim filename AsString
filename = "AG_" & DateTime.Date(DateTime.Now) & ".jpeg"
out = File.OpenOutput(File.DirRootExternal,filename,False)
canvas1.Bitmap.WriteToStream(out,
100,"JPEG")
out.Close
 

klaus

Expert
Licensed User
Longtime User
Unfortunately you don't give enough information.
It would be much easier for us to help you if you posted your project as a zip file or at least a smaller project showing the problem.
- What is in main.bal ?
- What is in pnlMain ?

Best regards.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Where are you looking for your file ?
I just added this code, before ResetCanvas, to see what happens:
B4X:
    Log(File.Exists(File.DirRootExternal,filename))
    Dim Files As List
    Files = File.ListFiles(File.DirRootExternal)
    For i = 0 To Files.Size - 1
        Log(Files.Get(i))
    Next
    ResetCanvas
And it works :)!
Tested in the Emulator and on my Nexus One.
Attached the image from the Nexus One.

Best regards.
 

Attachments

  • AG_12122011.jpg
    AG_12122011.jpg
    17.4 KB · Views: 169
Upvote 0

danoptic

Member
Licensed User
Longtime User
Like I said, so simple and so strange

For some reason, the file was n the directory but I can't see it in the gallery untill I reboot my phone!! strange.
 
Upvote 0
Top