aldakur
aldakur

Reputation: 419

How to know which of the fragments launched the current fragment

I launch fragment transition:

Fragment fragment = new InstalacionesEncontradasFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("key", this.instalacionesConCategorias);
fragment.setArguments(bundle);
FragmentManager fragmentManager = getFragmentManager();

InstalacionesEncontradasFragment
FragmentTransaction mFragmentTransaction = fragmentManager.beginTransaction();
mFragmentTransaction.addToBackStack(null);
mFragmentTransaction.replace(R.id.main_frame_container, fragment, "ACTIVIDADES").commit();

The second Fragment get de object as:

Bundle bundle = this.getArguments();
instalacionesConCategorias = (ArrayList<Instalacion>) getArguments().getSerializable("key");

But now i want get "ACTIVIDADES" tag. Because, I want to know which of the fragments launched the current fragment

Upvotes: 0

Views: 70

Answers (1)

X3Btel
X3Btel

Reputation: 1428

You could use different tags from different parents(I assume you do). And then in the child fragment you could call: this.getTag();

Upvotes: 1

Related Questions