private void displayCurrentQuestion(int staringQuestionNumber) {
   if (mQuestions.containsKey(staringQuestionNumber)) {
     mQuestionText.setCurrentText(this.getQuestionText(staringQuestionNumber));
     mQuestionImage.setImageDrawable(this.getQuestionImageDrawable(staringQuestionNumber));
   } else {
     handNoQuestion();
   }
 }
 private void handleAnswerAndShowNextQuestion(boolean bAnswer) {
   int CurScore = mGameSettings.getInt(GAME_PREFERENCES_SCORE, 0);
   int nextQuestionNumber = mGameSettings.getInt(GAME_PREFERENCES_CURRENT_QUESTION, 1) + 1;
   Editor editor = mGameSettings.edit();
   editor.putInt(GAME_PREFERENCES_CURRENT_QUESTION, nextQuestionNumber);
   if (bAnswer) editor.putInt(GAME_PREFERENCES_SCORE, CurScore + 1);
   editor.commit();
   if ((mQuestions.containsKey(nextQuestionNumber)) == false) {
     try {
       downloader = new QuizTask();
       downloader.execute(TRIVIA_SERVER_QUESTIONS, nextQuestionNumber);
     } catch (Exception e) {
       Log.e(DEBUG_TAG, "Loading initial question batch failed", e);
     }
   }
   if (mQuestions.containsKey(nextQuestionNumber)) {
     mQuestionText.setCurrentText(this.getQuestionText(nextQuestionNumber));
     mQuestionImage.setImageDrawable(this.getQuestionImageDrawable(nextQuestionNumber));
   } else {
     handNoQuestion();
   }
 }
예제 #3
0
 public void updateTabCount(int count) {
   mTabsCount.setCurrentText(String.valueOf(count));
   mTabs.setContentDescription(mContext.getString(R.string.num_tabs, count));
   mCount = count;
   updateTabs(GeckoApp.mAppContext.areTabsShown());
 }