I want to set visible
one button
in the last page but the last one element don't call the Fragment constructor
. ( I debugged it )
public Fragment getItem(int i) {
Fragment fragment = new DemoObjectFragment();
Bundle args = new Bundle();
args.putParcelable(DemoObjectFragment.ARG_OBJECT, check.getQuestionWithId(i));
if(check.getNQuestions()==i)
args.putBoolean(DemoObjectFragment.FINAL_QUEST,true);
@Override
public int getCount() {
return check.getNQuestions();
}
And the DemoObjectFragment:
public static class DemoObjectFragment extends Fragment {
public static final String ARG_OBJECT = "QUESTION";
public static final String FINAL_QUEST = "FINAL_QUEST";
public static final int requestCode_AnswerActivity = 1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.question_fragment, container, false);
Bundle args = getArguments();
final Question quest = args.getParcelable(ARG_OBJECT);
((TextView) rootView.findViewById(android.R.id.text1)).setText(
quest.getContent());
if(args.getBoolean(FINAL_QUEST)) {
Button finish_test = (Button) rootView.findViewById(R.id.button_finish_test);
finish_test.setVisibility(View.VISIBLE);
}
}
}
Thanks.