1

I have observed that some apps allow a user to share an image from the gallery app to multiple different activities within the same application. For example, if I try to share a photo from the gallery app to Instagram, there are multiple different choices that show up.Gallery Share Options I'm referring to I was wondering how I could implement this functionality in my Android studio project. When I try to share an image from my gallery, I want there to be multiple sharing options for my app.

  • Is this solving Your problem: https://stackoverflow.com/questions/8665066/how-to-implement-share-via-option-in-android –  Apr 25 '20 at 09:01
  • 1
    Unfortunately, it's not exactly what I'm looking for. I'm not trying to send photos from my app to another app. In the screenshot I provided, I have the gallery app open, and I'm trying to have multiple sharing options for my app when the user clicks the "Share" button. – user13403954 Apr 25 '20 at 09:08

1 Answers1

0

You can add intent-filter tag to your activity in manifest to receive data from sharing

Update your manifest like this

      <activity
        android:name=".test.Image2Activity"
        android:label="Activity 1">
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/*" />
        </intent-filter>
    </activity>
    <activity android:name=".test.Image1Activity"
        android:label="Activity 2"
        >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/*" />
        </intent-filter>
    </activity>

It has intent filter in both activities that accepts image. So when share an image from gallery it will show like this

The label of your activity will show while sharing.

Learn more about sharing here

Bhavik Kasundra
  • 113
  • 1
  • 9