Android - How to get Extras in an Innerfragment(Nested Fragment)?

Asked

Viewed 12 times

1

How to get a Extra within Fragment nestled in another Fragment?

I have an Activity with the following Layout:

Activity (que infla um){
  //Aqui a activity infla 3 Fragments para criar um BottomNavigation
  Fragment (que infla um){
    //Em um certo Fragment (uma dos três botões do BottomNavigation, é inflado alguns fragmentos em uma TabLayout
    InnerFragment
  }
}

I have no way to send a Bundle to the InnerFragment, only for Fragment, and according to documentation Fragments should never communicate directly.

And the approach getActivity().getIntent().getExtra().getInt() is not appropriate. As it makes the fragment not reusable.

What would be the right approach?

Example layout on Youtube:

inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.