I've added the intent-filter. And when I tap "share" in the Gallery, it will launch my activity.
<intent-filter>
<action
android:name="android.intent.action.SEND" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="image/*" />
</intent-filter>
But I don't know how to get the correct data from the current intent. Any helps?
EDIT: Sorry, missing "picture" in the question
Once you tap on a photo, you will see Share, Edit, Info and Delete icons appearing at the bottom of the screen. 4. Tap on the Share icon to launch the Share via popup menu on your Android Phone.
1 Open the Photos or Gallery app on your Android Phone or tablet. 2 Tap on the Photo that you would like to send or share with others. 3 Once you tap on a photo, you will see Share, Edit, Info and Delete icons appearing at the bottom of the screen. 4 Tap on the Share icon to launch the Share via popup menu on your Android Phone. ... More items...
Type in your Message, add recipient’s email address and send your email with the picture attached. The steps for sharing multiple photos on Android Phone are a bit different, but you will still get the same Share Via option, which makes it so easy to share images using email, text and messaging apps.
A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout. A dialog with a pre-defined UI that allows the user to select a date or time. Caution: Android includes another dialog class called ProgressDialog that shows a dialog with a progress bar.
I found the answer.
Uri imageUri = (Uri) getIntent().getExtras().get(Intent.EXTRA_STREAM);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With