The host activity can deliver messages to a fragment by capturing the
Fragment instance with findFragmentById(), then directly call the
fragment's public methods.
In your fragment - MyFragment, create a public method
public void myFragmentDataFromActivity(int passedDataFromActivity) {
// do your stuff
}
In your activity to pass an integer value say, 100 :
get MyFragment instance using getSupportFragmentManager or getFragmentManager by providing id/tag/position. Then call the public method in MyFragment instance.
MyFragment myFragment = (MyFragment) getSupportFragmentManager.getFragmentById(id);
myFragment.myFragmentDataFromActivity(100);
You can also use getFragmentByTag(tag), getFragments().get(position) instead of getFragmentById(id) to get fragment instance.
read more about this