Sub Activity_Resume
Log(Activity.GetStartingIntent.ExtrasToString)
If Activity.GetStartingIntent.Action="android.intent.action.MAIN" Then
MsgboxAsync("Please use the 'share' option of the other app... ","Info")
Return
End If
ImageList=GetUrisFromStartingIntent(Activity.GetStartingIntent)
If ImageList.Size>0 Then
If ImageList.size>1 Then 'remove the limit if needed
MsgboxAsync("Please select ONE image","Too many images")
Return
End If
For i=0 To ImageList.Size-1
Dim uri As String = ImageList.Get(i)
...
Private Sub GetUrisFromStartingIntent(in As Intent) As List
Log(in.Action)
Log(in.ExtrasToString)
Dim ImageList As List
ImageList.Initialize
If in.IsInitialized And in <> OldIntent Then
If in.Action = "android.intent.action.SEND" Or in.Action= "android.intent.action.SEND_MULTIPLE" Then
ImageList= GetImageUrisFromExtras(in.ExtrasToString, in.action)
End If
OldIntent = in
End If
Return ImageList
End Sub
Sub GetImageUrisFromExtras (Extras As String, Intent As String) As List
Log(Extras)
Dim ImageList As List
ImageList.Initialize
Dim JO As JavaObject = Activity.GetStartingIntent
Select Intent
Case "android.intent.action.SEND"
Dim uri As String = JO.RunMethod("getParcelableExtra", Array("android.intent.extra.STREAM"))
ImageList.Add(uri)
Case "android.intent.action.SEND_MULTIPLE"
Dim uris As List = JO.RunMethod("getParcelableArrayListExtra", Array("android.intent.extra.STREAM"))
If uris.Size > 0 Then
For i = 0 To uris.Size-1
ImageList.Add(uris.Get(i))
Next
End If
End Select
Return ImageList
End Sub