Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ActionView not restored on preHoneycomb devices #667

Closed
sealskej opened this Issue · 3 comments

4 participants

@sealskej

It seems there is a bug with restoring ActionView on preHoneycomb devices. It happens, when ActionView needs to be restored and when menuItem.setActionView(R.layout.my_layout) is used. Using menuItem.setActionView(myView) seems working fine.

10-18 22:25:43.915: ERROR/AndroidRuntime(2671): FATAL EXCEPTION: main
        java.lang.NullPointerException
        at android.view.View.dispatchRestoreInstanceState(View.java:6273)
        at android.view.ViewGroup.dispatchThawSelfOnly(ViewGroup.java:1228)
        at android.widget.AdapterView.dispatchRestoreInstanceState(AdapterView.java:767)
        at android.view.View.restoreHierarchyState(View.java:6257)
        at com.actionbarsherlock.internal.view.menu.MenuBuilder.restoreActionViewStates(MenuBuilder.java:361)
        at com.actionbarsherlock.internal.ActionBarSherlockCompat.preparePanel(ActionBarSherlockCompat.java:503)
        at com.actionbarsherlock.internal.ActionBarSherlockCompat.dispatchInvalidateOptionsMenu(ActionBarSherlockCompat.java:272)
        at com.actionbarsherlock.app.SherlockFragmentActivity.invalidateOptionsMenu(SherlockFragmentActivity.java:150)
        at com.actionbarsherlock.app.SherlockFragmentActivity.supportInvalidateOptionsMenu(SherlockFragmentActivity.java:156)
        at android.support.v4.app.Fragment.setMenuVisibility(Fragment.java:730)
        at io.generify.event.festival.x.adapter.HomeFragmentPagerAdapter.setPrimaryItem(HomeFragmentPagerAdapter.java:120)
        at android.support.v4.view.ViewPager.populate(ViewPager.java:893)
        at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:469)
        at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:441)
        at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:422)
        at io.generify.event.festival.x.activity.HomeActivity.onTabSelected(HomeActivity.java:79)
        at com.actionbarsherlock.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:526)
        at com.actionbarsherlock.internal.app.ActionBarImpl$TabImpl.select(ActionBarImpl.java:907)
        at com.actionbarsherlock.internal.widget.ScrollingTabContainerView$TabClickListener.onClick(ScrollingTabContainerView.java:504)
        at android.view.View.performClick(View.java:2485)
        at android.view.View$PerformClick.run(View.java:9080)
        at android.os.Handler.handleCallback(Handler.java:587)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:130)
        at android.app.ActivityThread.main(ActivityThread.java:3683)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:507)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
        at dalvik.system.NativeStart.main(Native Method)
@pacificsky

I can consistently repro this on pre-honeycomb devices when I set an actionLayout for a menu item in xml using android:actionLayout="@layout/some_layout"

@justinmuller

I believe this may be related to #652 and #721

@rahulparsani rahulparsani referenced this issue from a commit in rahulparsani/ActionBarSherlock
@rahulparsani rahulparsani Fix #667 NPE on sdk < ICS 19c36fc
@JakeWharton
Owner

Looking at a dot release to include this fix in the next week or two.

@JakeWharton JakeWharton closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.