Using ActionProvider in Android4.0 (API leverl 14) makes it easier to implement a user-friendly and efficient shared Action in the ActionBar. Once an ActionProvider is appended to the Intent ActionProvider menu, you only need to provide a shared Intent, and the rest of the work is done by it. Note: ActionProvider can only be used in API lever 14 and later versions. Update menu Declaration: to use javasactionprovider, we must first define the following content. Define the android: actionProviderClass attribute in the corresponding menu resource file <itme>. <Menu xmlns: android = "http://schemas.android.com/apk/res/android"> <item android: id = "@ + id/menu_item_share" android: showAsAction = "ifRoom" android: title = "Share" android: actionProviderClass = "android. widget. using actionprovider "/>... </menu> In addition, you need to provide the provider with the information you want to share. Set the sharing Intent: to implement the sharing actionprovider function, we must implement a sharing Intent. This Intent not only contains the content required by other Intent to transmit content to other applications, such as ACTION_SEND and extras, but also the following content. When filling your menu resources in your Activity or Fragment, you need to find MenuItem, use MenuItem. getActionProvider to get the Intent actionprovider instance, and use setintent provider to update the shared Intent. Private sector actionprovider mpipeline actionprovider ;... @ Overridepublic boolean onCreateOptionsMenu (Menu menu) {// Inflate menu resource file. getMenuInflater (). inflate (R. menu. performance_menu, menu); // Locate MenuItem with your actionprovider MenuItem item = menu. findItem (R. id. menu_item_share); // Fetch and store your actionprovider m?actionprovider = (?actionprovider) item. getActionProvider (); // Return true to display menu return true;} // Call to update the share intentprivate void setincluintent (Intent incluintent) {if (m?actionprovider! = Null) {m1_actionprovider. setincluintent (incluintent );}}