To put you in context, when the user clicks the floating action button the activity will check which fragment is active.
Then, depending on the fragment tag it will call a method in that specific instance.
I found a way to do it on this awesome forum but the only problem is that I don't understand what I'm doing here
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container);
if (fragment.getTag() == "EXERCISES_LIST_FRAGMENT") {
//THIS IS THE PART I DONT UNDERSTAND
ArrayList t = ((ExercisesListFragment) fragment).GetArray();
//THIS IS THE PART I DONT UNDERSTAND
System.out.println(t.size());
}
}
});
It seems like casting a variable but I searched and did not see anything like this.
I want to know what is that part : ((SomeKindofClass) variable).SomeKindOfClassMethod();
I would like to read about that but I don't know how you name that
sorry for my English
Thanks