I tried to use android.support.v7.widget.ShareActionProvider on actionbar in my app. So I followed the example from android document but got some issues.
Here\'s my m
After some reading and that includes probably some of you responses, finally this issued is solved:
Share_Menu.xml. Make sure you have a custom namespace and the actionProvider class is from that custom namespace as well as the correct value: android.support.v7.widget.ShareActionProvider
Detail_Activity.java
2.1. Inherit from ActionBarActivity instead of Activity
2.2. Add the correct imports
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.ShareActionProvider;
AndroidManifest.xml Add the android:theme="@style/Theme.AppCompat.Light"
Build.gradle
4.1. In my case just to stay in the safe side I turn offf ProGuard in Debug.
debug {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
4.2. Make sure that you have the following compile section in dependencies
`compile 'com.android.support:appcompat-v7:20.0.+'`