0

My only activity host onCreateOptionsMenu and onOptionsItemSelected but implementation of UI-Recyclerview is done in MainFragment.

From menu i would like to sort the list of Recyclerview. So i need to get the list then manipulate then to post back to MainFragment.

Please if someone know how to do this ?

Vasile
  • 313
  • 2
  • 7

1 Answers1

0

You can receive menu callbacks directly in the fragment, so you don't have to involve the activity. In your fragment onCreate call:

 setHasOptionsMenu(true);

Then implement the related menu handling callbacks in your fragment.

Check https://developer.android.com/guide/components/fragments#ActionBar

Eddie Lopez
  • 1,101
  • 7
  • 15