I have method in fragment class. I want to call that method from main activity but I don\'t want to use FragmentById (or) FragmentByTag.
My fragment method:
In Activity use something like this where you load your fragment:
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(container, fragment);
transaction.addToBackStack(null); // if you want to store transaction
transaction.commit();
currentFragment = fragment; // currentFragment is global Fragment variable
Use following line where you want to call fragment's method
currentFragment.setItemFromDrawer("sourceTag","destTag");