ActionBarSherlock
ActionBarSherlock copied to clipboard
ShareActionProvider crash with Theme.Sherlock.Light.DarkActionBar
I'm using the dev branch and i'm having problem with the ShareActionProvider. As soon as i click on the share button (or the app icon) i get this exception:
09-06 19:34:15.848: E/AndroidRuntime(31698): FATAL EXCEPTION: main
09-06 19:34:15.848: E/AndroidRuntime(31698): android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.actionbarsherlock.widget.ActivityChooserView$ActivityChooserViewAdapter.getView(ActivityChooserView.java:730)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.actionbarsherlock.widget.ActivityChooserView$ActivityChooserViewAdapter.measureContentWidth(ActivityChooserView.java:772)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.actionbarsherlock.widget.ActivityChooserView.showPopupUnchecked(ActivityChooserView.java:357)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.actionbarsherlock.widget.ActivityChooserView.access$2(ActivityChooserView.java:329)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.actionbarsherlock.widget.ActivityChooserView$Callbacks.onClick(ActivityChooserView.java:585)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.View.performClick(View.java:4084)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.View$PerformClick.run(View.java:16966)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.os.Handler.handleCallback(Handler.java:615)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.os.Handler.dispatchMessage(Handler.java:92)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.os.Looper.loop(Looper.java:137)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-06 19:34:15.848: E/AndroidRuntime(31698): at java.lang.reflect.Method.invokeNative(Native Method)
09-06 19:34:15.848: E/AndroidRuntime(31698): at java.lang.reflect.Method.invoke(Method.java:511)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-06 19:34:15.848: E/AndroidRuntime(31698): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-06 19:34:15.848: E/AndroidRuntime(31698): at dalvik.system.NativeStart.main(Native Method)
09-06 19:34:15.848: E/AndroidRuntime(31698): Caused by: java.lang.reflect.InvocationTargetException
09-06 19:34:15.848: E/AndroidRuntime(31698): at java.lang.reflect.Constructor.constructNative(Native Method)
09-06 19:34:15.848: E/AndroidRuntime(31698): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
09-06 19:34:15.848: E/AndroidRuntime(31698): ... 21 more
09-06 19:34:15.848: E/AndroidRuntime(31698): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010047 a=-1}
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.content.res.Resources.loadDrawable(Resources.java:1892)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.View.<init>(View.java:3336)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.view.ViewGroup.<init>(ViewGroup.java:427)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
09-06 19:34:15.848: E/AndroidRuntime(31698): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
09-06 19:34:15.848: E/AndroidRuntime(31698): ... 24 more
This happens just with Theme.Sherlock.Light.DarkActionBar
, with the other two themes it is working properly.
I can not click on Share item.
Have the same problem as soon as I add android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider" to my xml file I get InflateException. It happens on any theme.
I solved my problem using the right context when i create the ShareActionProvider.
I was using
ShareActionProvider shareActionProvider = new ShareActionProvider(getActivity());
but the right way to create it is:
ShareActionProvider shareActionProvider = new ShareActionProvider(getSherlockActivity().getSupportActionBar().getThemedContext());
I am also experiencing this problem on ICS. Switching themes does not seem to make a difference and getSupportActionBar().getThemedContext()
does not help.
I was able to get this working by setting the theme back to the base Theme.Sherlock theme so it seems that something is missing in the Holo.Theme.Sherlock theme.
I change my theme to android:theme="@style/Theme.Sherlock" and it works, but i need use a custom theme. Does anyone have another solution? My custom theme extends Theme.Sherlock.Light.DarkActionBar.