Learn How to Share Content using an Action Provider

In this Article you will learn how to add a Share feature to your App.

This will enable users of your app to share content. For instance a user might want to share an image being displayed on the App, using a Messenger or an Email.

In order to do this you need to add an Action Provider to the Action Bar.

Here are the steps:

1. Add a share action provider to the menu xml file.

<item
android:id=”@+id/action_share”
android:title=”@string/action_share”
android:orderInCategory=”2″
android:showAsAction=”always”
android:actionProviderClass=”android.widget.ShareActionProvider” />

2. Specify the content to be passed using an intent in your Activity.

Please refer to the code here

Author: androidsmartly

I am a Tech Enthusiast who likes to work on new Ideas. Sharing knowledge on Android, Marketing, Startups and More.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s