With the MultiPhotoPickerEx demo, ContentChooser logs the path of images in internal storage and external USB Card.
The path might have 4, 5, or 6 parameters :
Photo = /storage/BADC-14DA/1ScrMe/3.jpg 'SD Card folder *4
Photo = /storage/emulated/0/Pictures/Messenger_Lite/16e1.0.jpg 'internal Pictures folder *6
How can I parse the path string into 2 parameters (Dir As String, File As String)?
Private myDir As String
Private myFile As String
Ending up with:
myDir = "/storage/BADC-14DA/1ScrMe"
OR
myDir = "/storage/emulated/0/Pictures/Messenger_Lite"
AND
myFile = "3.jpg"
I am at my wits end with this task. Thanks in advance.
B4X:
Sub MPP_onPhotoPicked(photos As List)
'This provides USB path as:
' Photo = /storage/BADC-14DA/dwnLD/3.jpg
If photos <> Null Then
If photos.Size > 0 Then
For i= 0 To photos.Size -1
Log($"Photo = ${photos.Get(i)}"$) ' How to parse this into (Dir As String, File As String)?
' This provides USB path as:
'storage
'BADC-14DA
'dwnLD
'3.jpg
Dim s As String = photos.Get(i)
Dim paramnum () As String = Regex.Split("\/", s)
For Each n As String In paramnum
Log(n) ' Or how to parse this into (Dir As String, File As String)?
Next
Next
End If
End If
End Sub
Photo = /storage/BADC-14DA/1ScrMe/3.jpg 'SD Card folder *4
Photo = /storage/emulated/0/Pictures/Messenger_Lite/16e1.0.jpg 'internal Pictures folder *6
How can I parse the path string into 2 parameters (Dir As String, File As String)?
Private myDir As String
Private myFile As String
Ending up with:
myDir = "/storage/BADC-14DA/1ScrMe"
OR
myDir = "/storage/emulated/0/Pictures/Messenger_Lite"
AND
myFile = "3.jpg"
B4X:
' Log file
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
** Activity (main) Resume **
Photo = /storage/BADC-14DA/dwnLD/3.jpg
storage
BADC-14DA
dwnLD
3.jpg
Photo = /storage/BADC-14DA/dwnLD/1.jpg
storage
BADC-14DA
dwnLD
1.jpg
Photo = /storage/BADC-14DA/dwnLD/2.jpg
storage
BADC-14DA
dwnLD
2.jpg
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
** Activity (main) Resume **
Photo = /storage/emulated/0/Pictures/Messenger_Lite/1.jpg
storage
emulated
0
Pictures
Messenger_Lite
1.jpg
Photo = /storage/emulated/0/Pictures/Messenger_Lite/2.jpg
storage
emulated
0
Pictures
Messenger_Lite
2.jpg
Photo = /storage/emulated/0/Pictures/Messenger_Lite/3.jpg
storage
emulated
0
Pictures
Messenger_Lite
3.jpg