Other than passing data in the Intent Bundle, there is a way to get direct access to a Fragment.
In a FragmentActivity, you use FragmentManager to add your Fragment.
You can also use FragmentManager to get your Fragment (using findById()). After getting it and casting it to your classname, you can then easily call public methods in your Fragment.
Example:
FragmentManager fm = getSupportFragmentManager();
MyFragment fragment = (MyFragment) fm.findFragmentById(R.id.fragmentContainer);
fragment.updateData(..);
EDIT
To get data from the passed intent do something like this:
Intent in = getActivity().getIntent();
String str = in.getStringExtra(EXTRA_STRING_DATA);
The getArguments() is for a Bundle attached to the Fragment, not the one passed in the Intent.
EDIT2
You can't create the Fragment the way you are doing it.
In your activity do this:
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
// int position =5;
String check="checking...";
Galleries fragment = Galleries,newInstance(check);
tx.replace(R.id.main, Fragment.instantiate(MainActivity.this, fragment));
tx.commit();
Create a static method in Galleries:
public static Fragment newInstance(String check) {
Bundle args = new Bundle();
args.putString("id_cat", check);
Galleries fragment = new Galleries();
fragment.setArguments(args);
return fragment;
}
Now you can do getArguments() in onCreateView().