public void changeComponents() { if (exam.getCatalogs().size() > 1) { Catalog catalog = ExamParse.getCatalog(exam, cId); catalogsTV.setText( String.valueOf(cId) + ". " + catalog.getName() + "(Q" + String.valueOf(1) + " - " + "Q" + String.valueOf(ExamParse.getMaxQuestion(exam, cId)) + ")"); } else { // set catalogsTV invisible } // change question content String questionHint = "Q" + String.valueOf(question.getIndex()) + " (" + mContext.getResources().getString(R.string.msg_question_score) + ":" + String.valueOf(question.getScore()) + ")\n"; questionTV.setText(questionHint + question.getContent()); // change choices if (choiceAdapter == null) { choiceAdapter = new ChoiceAdapter( mContext, question.getChoices(), question.getType(), answers.toString()); listView.setAdapter(choiceAdapter); } else { choiceAdapter.refresh(question.getChoices()); } Drawable firstImg = getResources().getDrawable(R.drawable.ic_first_question_64); Drawable backImg = getResources().getDrawable(R.drawable.ic_back_64); backArrow.setImageDrawable(qId == 1 ? firstImg : backImg); String pendNumString = mContext.getResources().getString(R.string.label_tv_waiting) + "(" + Integer.valueOf(pendQuestions.size()) + ")"; pendQueNumber.setText(pendNumString); Drawable lastImg = getResources().getDrawable(R.drawable.ic_last_question_64); Drawable nextImg = getResources().getDrawable(R.drawable.ic_next_64); nextArrow.setImageDrawable(qId == ExamParse.getMaxQuestion(exam, cId) ? lastImg : nextImg); }
public void loadQuestion() { // get question cId = SPUtil.getIntegerFromSP(SPUtil.CURRENT_CATALOG_ID, sharedPreferences); if (cId == 0) cId = 1; qId = SPUtil.getIntegerFromSP(SPUtil.CURRENT_QUESTON_ID, sharedPreferences); if (qId == 0) qId = 1; question = ExamParse.getQuestion(exam, cId, qId); }