Hi
I am trying to save a picture to the device but I'm having a couple of issues. I'm using this code to save the picture:
The first is using the File Dialog. At first, this is the way I wanted it to work but I think I'd prefer to just save the pictures directly to the standard photos / pictures folder and not use the dialog. Is there a constant for this or a way of finding out the path to the photo folder without hard coding it?
The second issue is if I navigate to the photo folder (under 'sdcard\photo') using the dialog then I can save the image there instead which is fine. However, the problem is I then I want to see the saved picture in the gallery but the saved pictures don't show unless I reboot the phone? Is there some message or method I need to call in order to get the pictures to show up in the gallery?
I'm initialising the content chooser in Activity_Create like this:
and then invoking it based on a button click like this:
Thanks
I am trying to save a picture to the device but I'm having a couple of issues. I'm using this code to save the picture:
B4X:
Dim dlg As FileDialog
Dim response As Int
If File.ExternalWritable Then
dlg.FilePath = File.DirDefaultExternal
End If
response = dlg.Show(gAppName, "Save", "Cancel", "", Null)
If response = DialogResponse.POSITIVE Then
If dlg.ChosenName <> "" Then
Dim out As OutputStream
out = File.OpenOutput(dlg.FilePath, dlg.ChosenName & ".jpg", False)
mFrontCanvas.Bitmap.WriteToStream(out, 100, "JPEG")
out.Flush
out.Close
ToastMessageShow("Picture saved", True)
Else
ToastMessageShow("No filename entered", True)
End If
End If
The first is using the File Dialog. At first, this is the way I wanted it to work but I think I'd prefer to just save the pictures directly to the standard photos / pictures folder and not use the dialog. Is there a constant for this or a way of finding out the path to the photo folder without hard coding it?
The second issue is if I navigate to the photo folder (under 'sdcard\photo') using the dialog then I can save the image there instead which is fine. However, the problem is I then I want to see the saved picture in the gallery but the saved pictures don't show unless I reboot the phone? Is there some message or method I need to call in order to get the pictures to show up in the gallery?
I'm initialising the content chooser in Activity_Create like this:
B4X:
mContentChooser.Initialize("mContentChooser")
and then invoking it based on a button click like this:
B4X:
mContentChooser.Show("image/*", "Choose Picture")
Thanks