Here's the code I'm using to open an image taken with the camera with the default gallery:
B4X:
Dim i As Intent
'i.Initialize(i.ACTION_VIEW, "/mnt/sdcard/DCIM/Camera/IMG_20121027_205219.jpg")
i.Initialize(i.ACTION_VIEW, "mnt/sdcard/DCIM/Camera/IMG_20121027_205219.jpg")
Log("mnt/sdcard/DCIM/Camera/IMG_20121027_205219.jpg")
i.SetType("image/*")
StartActivity(i)
Log("error:"&I)
When I click the button, the gallery opens and then just force closes itself. I need to open the image in the gallery viewer so it has the options of the gallery. For example, the default installed gallery usually has the options to share, set as, or delete a photo and that's what I need.
That does bring up the gallery to choose a image, however, when you choose an image it takes you back to your app. I need to open the image in the gallery viewer so it has the options of the gallery. For example, the default installed gallery usually has the options to share, set as, or delete a photo and that's what I need.
Hmm that is a somewhat decent workaround. I'd like for them to be able to choose the picture so they can see it full sized as well as have the different options.
But i have an erro when I initialize the variable :
Dim ImageChooser As ContentChooser
Compiling code.
Error
Error parsing program.
Error description: Unknown type: contentchooser
Are you missing a library reference?
Occurred on line: 85
Dim ImageChooser As ContentChooser
Dim selectedimage As ContentChooser
selectedimage.Initialize("imgChooser")
selectedimage.show("image/*", "Choose image")
Sub selectedimage_Result (Success As Boolean, Dir As String, FileName As String, ControlName As String)
If Success Then
ControlName.Bitmap = LoadBitmap(Dir, FileName)
ControlName.Gravity = Gravity.FILL
Else
ToastMessageShow("Nessuna Immagine Selezionata", True)
End If
End Sub
Sub Set_Button1_Click
ImageChooser1.Initialize("imgChooser1")
ImageChooser1.show("image/*", "Choose image")
End Sub
do not handle the result event?
B4X:
Sub imgChooser1_Result(Success As Boolean, Dir As String, FileName As String)
If Success Then
pec1.Bitmap = LoadBitmap(Dir, FileName)
pec1.Gravity = Gravity.FILL
Else
ToastMessageShow("Nessuna Immagine Selezionata", True)
End If
End Sub