2

I am trying to develop an ActionBar which contains a share button, but if the user clicks on the share nothing happens.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/menu_item_share"
        app:showAsAction="ifRoom"
        android:title="Share"
        android:actionProviderClass=
            "android.widget.ShareActionProvider" />
    ...
</menu>
Bö macht Blau
  • 12,820
  • 5
  • 40
  • 61
Maddie_J
  • 171
  • 3
  • 15

1 Answers1

1

You should use the app compat's action provider as:

<item
    android:id="@+id/menu_item_share"
    app:showAsAction="ifRoom"
    android:title="Share"
    app:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
Selçuk Cihan
  • 1,979
  • 2
  • 17
  • 30
  • 1
    I'm having same problem that the share item is not clickable, although I'm using `android.support.v7.widget.ShareActionProvider` any ideas ? – Poula Adel Jun 27 '17 at 08:23