Share Option in Android

516 views.

Today we are going to learn how to implement an effective and user friendly share action in android app. sharing option is powerful feature given by android where user can share simple text or data across social networking app ,e-mail,message etc.share option open multiple channels where user can select one of them and share content on sharing applications available on their own devices.

when you construct an intent, you must specify the action you want the intent to “trigger.” Android defines several actions, including ACTION_SEND which, as you can probably guess, indicates that the intent is sending data from one activity to another, even across process boundaries. To send data to another activity, all you need to do is specify the data and its type, the system will identify compatible receiving activities and display them to the user (if there are multiple options) or immediately start the activity (if there is only one option). Similarly, you can advertise the data types that your activities support receiving from other applications by specifying them in your manifest.

If there’s an installed application with a filter that matches ACTION_SEND and MIME type text/plain, the Android system will run it; if more than one application matches, the system displays a disambiguation dialog (a “chooser”) that allows the user to choose an app.

Even if the user has previously selected a default action for this intent, the chooser will still be displayed.
If no applications match, Android displays a system message.
You can specify a title for the chooser dialog.

activity_share.xml

ShareActivirty.java

Manifestfile.xml

droid@screen-2

You may also like...

Leave a Reply