Android Question Can Activity.GetStartingIntent be reset or cleared?

Gregg Homan

Member
Licensed User
Longtime User
Hello,

I use the code (below) within Activity_Create to process starting intents stemming from multiple images selected via Gallery app's share menu. I also added intent filters (below) to my manifest file so that my app is visible and 'selectable' from Gallery app's share menu. Everything works fine except that the code below keeps seeing the same starting intent each time Activity_Create() is invoked by successively pausing and resuming of my app. I added a string variable named strStartingIntent (below) to 'strong-arm' a solution, but, I am looking for a more elegant way to reset or clear 'something' within the starting intent so that successive calls to Activity.GetStartingIntent do not keep returning the same intent.

Q1) Can anyone suggest a way to reset or clear 'something' within the starting intent?

Q2) Also, I am aware of the ContentChooser module for single file selections; but, can anyone suggest a B4A module/library that mimics gallery app's functionality that enables multiple file selection via share menu?

Thanks,
Gregg

Code used withing Activity_Create() to process multiple image intents
B4X:
Sub Process_Globals
   Dim strStartingIntent As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Dim Intent1 As Intent
    Intent1 = Activity.GetStartingIntent
    If  Intent1.HasExtra("android.intent.extra.STREAM") Then
        Dim str As String = Intent1.ExtrasToString.ToLowerCase
        If str <> strStartingIntent Then
            strStartingIntent = str
            'Process Intent
        End If
    End If
End Sub

Intent filters that I added to the manifest file
B4X:
AddActivityText(Main,
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.SEND_MULTIPLE" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>)
 
Top