You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create an activity which extends LightCycleAppCompatActivity and it contains a fragment which extends LightCycleSupportFragment, the activity receives a callback to onOptionsItemSelected when you select an option item (as usual), but the fragment doesn't.
It seems like this might be due to LightCycleAppCompatActivity not calling super.onOptionsItemSelected() - therefore the event doesn't get propagated to the fragments in the activity.
As a temporary solution, forwarding the call manually does the trick. Example:
// In the Activity@OverridepublicbooleanonOptionsItemSelected(MenuItemitem) {
Stringtag = getString(R.string.fragment_example);
returnfindExampleFragment(tag).onOptionsItemSelected(item);
}
xrigau
changed the title
LightCycle swallows onOptionsItemSelected
LightCycleAppCompatActivity swallows onOptionsItemSelected
Jul 20, 2016
If you create an activity which extends
LightCycleAppCompatActivity
and it contains a fragment which extendsLightCycleSupportFragment
, the activity receives a callback toonOptionsItemSelected
when you select an option item (as usual), but the fragment doesn't.It seems like this might be due to
LightCycleAppCompatActivity
not callingsuper.onOptionsItemSelected()
- therefore the event doesn't get propagated to the fragments in the activity.See: https://github.com/soundcloud/lightcycle/blob/master/lightcycle-lib/src/main/java/com/soundcloud/lightcycle/LightCycleAppCompatActivity.java#L47
The text was updated successfully, but these errors were encountered: