Creating a fragment using the default constructor generally isn't the way to go. Here is an example of what you could better be doing for creating a new instance of your fragment and passing an integer with it.
Place this code in your fragment that will be created.
public class ExampleFragment {
public static ExampleFragment newInstance(int exampleInt) {
ExampleFragment fragment = new ExampleFragment();
Bundle args = new Bundle();
args.putInt("exampleInt", exampleInt);
fragment.setArguments(args);
return fragment;
}
}
Use this in your activity to create a new fragment.
Fragment exampleFragment = ExampleFragment.newInstance(exampleInt);
And later in your fragment, use something like this to get your integer.
getArguments().getInt("exampleInt", -1);