// newInstance constructor for creating fragment with arguments public static FirstFragment newInstance(int page, boolean activos) { FirstFragment fragmentFirst = new FirstFragment(); Bundle args = new Bundle(); args.putInt("someInt", page); args.putBoolean("someBoolean", activos); fragmentFirst.setArguments(args); return fragmentFirst; }