Example #1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.reset_score:
       PreferenceUtil.setCorrectAnswers(activity, 0);
       PreferenceUtil.setIncorrectAnswers(activity, 0);
       winsCountText.setText(activity.getString(R.string.wins) + 0);
       lossesCountText.setText(activity.getString(R.string.losses) + 0);
       return true;
   }
   return false;
 }
Example #2
0
 private void addToIncorrectCount() {
   int previousIncorrectAnswers = PreferenceUtil.getIncorrectAnswers(activity);
   int currentIncorrectAnswers = ++previousIncorrectAnswers;
   PreferenceUtil.setIncorrectAnswers(activity, previousIncorrectAnswers++);
   lossesCountText.setText(activity.getString(R.string.losses) + currentIncorrectAnswers);
 }