Android Question Select multiple images from the gallery

KZero

Active Member
Licensed User
Longtime User
Hi,

i'm wondering if it still not possible to select multiple images from the gallery as i saw it in many apps


thanks in advanced
 

KZero

Active Member
Licensed User
Longtime User
Seems like there is a new API in Android 4.3 which allows you to select multiple images from the gallery. If it is relevant (as it will not work on older versions) then I can help you implement it.

for 4.3 only will not be suitable for me i will look for an alternative library
 
Upvote 0

borofan

Member
Licensed User
Longtime User
Seems like there is a new API in Android 4.3 which allows you to select multiple images from the gallery. If it is relevant (as it will not work on older versions) then I can help you implement it.
Hi @Erel , Is this info documented anywhere? I'm interested in selecting multiple images from the gallery.
Many thanks.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried the solution described here: http://stackoverflow.com/questions/19585815/select-multiple-images-from-android-gallery
with this code. However it doesn't work on Nexus 5.
B4X:
Sub Activity_Click
   Dim i As Intent
   i.Initialize("android.intent.action.GET_CONTENT", "")
   i.PutExtra("android.intent.extra.ALLOW_MULTIPLE", True)
   i.SetType("image/*")
   StartActivityForResult(i)
End Sub

Sub ion_Event (MethodName As String, Args() As Object) As Object
'Args(0) = resultCode
'Args(1) = intent
   Return Null
End Sub

Sub StartActivityForResult(i As Intent)
  Dim jo As JavaObject = GetBA
  ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
  jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub

Sub GetBA As Object
  Dim jo As JavaObject
  Dim cls As String = Me
  cls = cls.SubString("class ".Length)
  jo.InitializeStatic(cls)
  Return jo.GetField("processBA")
End Sub
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I've tried the solution described here: http://stackoverflow.com/questions/19585815/select-multiple-images-from-android-gallery
with this code. However it doesn't work on Nexus 5.
B4X:
Sub Activity_Click
   Dim i As Intent
   i.Initialize("android.intent.action.GET_CONTENT", "")
   i.PutExtra("android.intent.extra.ALLOW_MULTIPLE", True)
   i.SetType("image/*")
   StartActivityForResult(i)
End Sub

Sub ion_Event (MethodName As String, Args() As Object) As Object
'Args(0) = resultCode
'Args(1) = intent
   Return Null
End Sub

Sub StartActivityForResult(i As Intent)
  Dim jo As JavaObject = GetBA
  ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
  jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub

Sub GetBA As Object
  Dim jo As JavaObject
  Dim cls As String = Me
  cls = cls.SubString("class ".Length)
  jo.InitializeStatic(cls)
  Return jo.GetField("processBA")
End Sub
Hi Erel, this code does not work with my LG G3, i'm running L Version on it, the app does not crash at all, i can see the image gallery come up but i can not choose multiple images, are you aware of any other way to select multiple images and return the path for all the images selected.
I'm currently looking at this library https://github.com/luminousman/MultipleImagePick/blob/master/src/com/luminous/pick/MainActivity.java but unfortunately my knowledge about intents is zero otherwise i would give it a shot and wrap it. Please let me know if there is a way without having to write a library to accomplish multiple selection of images.

Thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
has anybody found a solution for selecting multiple images from the gallery?
I have, i added some stuff to one of Informatix's classes, i will share the class with you soon, as son as i find it.

:D
 
Upvote 0

Esteve

Member
Licensed User
Hello
How I can obtain the paths of a multiple selection?
I would like to obtain the items of the array mItems
Cap.PNG

Thank you!
 
Upvote 0
Top