Try the following:
Inside your FragmentActivity class, put this:
MyFragmentClass mFrag = new MyFragmentClass();
Bundle bundle = new Bundle();
bundle.putString("DocNum", docNum);
mFrag.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.page_fragments, mFrag).commit();
Im using "import android.support.v4.app.FragmentActivity;" so I use "getSupportFragmentManager ()". So, to summarize the above code, u created an instance of the package and an instance of your fragment. Then you linked the two objects with "mFrag.setArguments (bundle)". So now the “package” is associated with this instance of your MyFragmentClass. Therefore, anywhere in your MyFragmentClass, download the package by calling:
Bundle bundle = getArguments();
String mDocNum = bundle.getString("DocNum");
source
share