grant1842 Active Member Licensed User Longtime User Oct 28, 2012 #1 Here's the code I'm using to open an image taken with the camera with the default gallery: Code: Copy 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. Last edited: Oct 28, 2012
Here's the code I'm using to open an image taken with the camera with the default gallery: Code: Copy 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.
D Dave Fitzpatrick Member Licensed User Longtime User Oct 28, 2012 #2 Try this: Dim ImageChooser As ContentChooser ImageChooser.Initialize("imgChooser") ImageChooser.show("image/*", "Choose image") Sub imgChooser_Result(Success As Boolean, Dir As String, FileName As String) if Success then 'do whatever end if end sub - - Dave Upvote 0
Try this: Dim ImageChooser As ContentChooser ImageChooser.Initialize("imgChooser") ImageChooser.show("image/*", "Choose image") Sub imgChooser_Result(Success As Boolean, Dir As String, FileName As String) if Success then 'do whatever end if end sub - - Dave
grant1842 Active Member Licensed User Longtime User Oct 28, 2012 #3 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. Upvote 0
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.
D Dave Fitzpatrick Member Licensed User Longtime User Oct 28, 2012 #4 Rather than clicking the image. Press and hold on it until it displays a list of options, i.e., delete, move, copy, "SHARE", etc. Upvote 0
Rather than clicking the image. Press and hold on it until it displays a list of options, i.e., delete, move, copy, "SHARE", etc.
grant1842 Active Member Licensed User Longtime User Oct 28, 2012 #5 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. Upvote 0
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.
angelone Member Licensed User Longtime User Apr 8, 2013 #6 Sorry if i resume this old post. I have to choose an image from image gallery, and set it as background of a button. How can i get the image file name? Selectedimage = LoadBitmap(File.Dirofchoosedimage,"choosedimagefilename.jpg") Button1.SetBackgroundImage(Selectedimage) Last edited: Apr 8, 2013 Upvote 0
Sorry if i resume this old post. I have to choose an image from image gallery, and set it as background of a button. How can i get the image file name? Selectedimage = LoadBitmap(File.Dirofchoosedimage,"choosedimagefilename.jpg") Button1.SetBackgroundImage(Selectedimage)
Erel B4X founder Staff member Licensed User Longtime User Apr 8, 2013 #7 You should use Dir and FileName passed in the Result event. Upvote 0
angelone Member Licensed User Longtime User Apr 8, 2013 #8 Thank's ergel, is there an example Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 8, 2013 #9 Here: http://www.b4x.com/forum/basic4android-updates-questions/27763-imageview-crashes.html#post160861 Upvote 0
Here: http://www.b4x.com/forum/basic4android-updates-questions/27763-imageview-crashes.html#post160861
angelone Member Licensed User Longtime User Apr 15, 2013 #10 Hi, thank's a lot for your help. 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 How can i add reference? Last edited: Apr 15, 2013 Upvote 0
Hi, thank's a lot for your help. 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 How can i add reference?
angelone Member Licensed User Longtime User Apr 15, 2013 #11 Sorry... solved :sign0013::sign0013::sign0013: Upvote 0
angelone Member Licensed User Longtime User Apr 15, 2013 #12 Hi, may i pass the name of Imageview in this way? 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 Upvote 0
Hi, may i pass the name of Imageview in this way? 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
Erel B4X founder Staff member Licensed User Longtime User Apr 15, 2013 #13 You cannot add a parameter to an event sub. Upvote 0
angelone Member Licensed User Longtime User Apr 16, 2013 #14 Do not handle the evente Result Hi, why this code Code: Copy Sub Set_Button1_Click ImageChooser1.Initialize("imgChooser1") ImageChooser1.show("image/*", "Choose image") End Sub do not handle the result event? Code: Copy 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 Upvote 0
Do not handle the evente Result Hi, why this code Code: Copy Sub Set_Button1_Click ImageChooser1.Initialize("imgChooser1") ImageChooser1.show("image/*", "Choose image") End Sub do not handle the result event? Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Apr 16, 2013 #15 Where is ImageChooser1 declared? Have you checked the logs? Upvote 0
angelone Member Licensed User Longtime User Apr 16, 2013 #16 in sub globals Dim ImageChooser1 As ContentChooser Attachments facilitatore.zip facilitatore.zip 8.8 KB · Views: 876 Last edited: Apr 16, 2013 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 16, 2013 #17 If you check the logs you will see this message: "onActivityResult: IOnActivityResult was released" You should declare ContentChooser as a process global variable. Upvote 0
If you check the logs you will see this message: "onActivityResult: IOnActivityResult was released" You should declare ContentChooser as a process global variable.