Sub Activity_Resume
Dim ImageList As List
ImageList=GetImages(Activity.GetStartingIntent)
If ImageList.Size>0 Then
Dim uri As String = ImageList.Get(0) 'Just the first image
Try
Log("Loading bitmap from: " & uri)
Dim bmp As Bitmap = LoadBitmapSample("ContentDir", uri, 100%x, 100%y)
Activity.SetBackgroundImage(bmp)
Catch
Log(LastException)
End Try
End If
End Sub
Private Sub GetImages(in As Intent) As List
Log(in.Action)
Log(in.GetData)
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= GetImagePathsFromExtras(in.ExtrasToString)
End If
OldIntent = in
End If
Return ImageList
End Sub
Sub GetImagePathsFromExtras (Extras As String) As List
Log(Extras)
Dim ImageList As List
ImageList.Initialize
If Extras.StartsWith("Bundle") Then
'Bundle[{makeup=false, KEY_ITEM_ORIENTATION_LIST=[0, 0], food=false, KEY_ITEM_MIME_TYPE_LIST=[image/*, image/*], KEY_MEDIA_SET_PATH=/local/camera, android.intent.extra.STREAM=[content://media/external/images/media/13930, content://media/external/images/media/13935]}]
Dim pos As Int = Extras.IndexOf("content://")
If pos >=0 Then
Extras=Extras.SubString2(pos-1,Extras.Length) 'Not that elegant, but it works
Extras=Extras.Replace("}","")
Extras=Extras.Replace("[","")
Extras=Extras.Replace("]","")
Extras=Extras.Replace(" ","")
Extras=Extras.Replace("=","")
Log(Extras)
Dim Images() As String
Images = Regex.Split(",", Extras)
ImageList.Initialize2(Images)
Log(ImageList)
End If
End If
Return ImageList
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub