@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.review_page, null); } Question question = getItem(position); TextView questionNumberTextView = (TextView) convertView.findViewById(R.id.review_question_number); questionNumberTextView.setText(String.valueOf(question.getNumberInInstrument())); questionNumberTextView.setTextColor(Color.BLACK); TextView questionTextView = (TextView) convertView.findViewById(R.id.review_question_text); questionTextView.setText(Html.fromHtml(question.getText())); questionTextView.setMaxLines(2); return convertView; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); mSkippedQuestions = new ArrayList<Question>(); ArrayList<String> skippedQuestionsIds = new ArrayList<String>(); skippedQuestionsIds = getActivity().getIntent().getExtras().getStringArrayList(EXTRA_REVIEW_QUESTION_IDS); mSurvey = Survey.load( Survey.class, getActivity().getIntent().getExtras().getLong(EXTRA_REVIEW_SURVEY_ID)); for (String id : skippedQuestionsIds) { Question q = Question.findByQuestionIdentifier(id); if (q != null) { mSkippedQuestions.add(q); } } setListAdapter(new QuestionAdapter(mSkippedQuestions)); getActivity().setTitle("Skipped Questions"); }
@Override public void onListItemClick(ListView l, View v, int position, long id) { Question question = ((QuestionAdapter) getListAdapter()).getItem(position); setReturnResults(question.getRemoteId()); }