title: Android Studio keeps saying, that I need to declare a final variable
body: <p>Hey I´m new in programming, especially in java and xml. I want to make a game where a progressbar show the time that is left for a task to do but Android Studio keeps saying, that I need to declare a final variable to use i++ and mProgressBar.setProgress (i); because its in a inner Class. But as far as I know a final variable cannot change it´s value. What should I change to make the code work again?</p>
  
  <pre><code>@Override
  public void onResume() {
      super.onResume();
  
      View decorView = getWindow().getDecorView();
      decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
              | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
              | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN
              | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
      final ImageView ball = (ImageView) findViewById(R.id.ball);
      ball.setOnTouchListener(new View.OnTouchListener()
      {
          PointF DownPT = new PointF(); // Record Finger Position When Pressed Down
          PointF StartPT = new PointF(); // Record Start Position of 'ball'
  
          @Override
          public boolean onTouch(View v, MotionEvent event)
          {
              int eid = event.getAction();
              switch (eid)
              {
                  case MotionEvent.ACTION_MOVE :
                      PointF mv = new PointF( event.getX() - DownPT.x, event.getY() - DownPT.y);
                      ball.setX((int)(StartPT.x+mv.x));
                      ball.setY((int)(StartPT.y+mv.y));
                      StartPT = new PointF(ball.getX(), ball.getY() );
                      break;
                  case MotionEvent.ACTION_DOWN :
                      DownPT.x = event.getX();
                      DownPT.y = event.getY();
                      StartPT = new PointF(ball.getX(), ball.getY() );
                      break;
                  case MotionEvent.ACTION_UP :
                      // Nothing have to do
                      break;
                  default :
                      break;
              }
              return true;
          }
      });
      ProgressBar mProgressBar;
      CountDownTimer mCountDownTimer;
      int i=0;
  
      mProgressBar=(ProgressBar)findViewById(R.id.progressBartime);
      mProgressBar.setProgress(i);
      mCountDownTimer=new CountDownTimer(3000,1000) {
  
          @Override
          public void onTick(long millisUntilFinished) {
              Log.v("Log_tag", "Tick of Progress"+ i+ millisUntilFinished); //i needs to be declared as final
              i++; //i needs to be declared as final
              mProgressBar.setProgress(i); //mProgressBar needs to be declared as final
  
          }
  
  
          @Override
          public void onFinish() {
              //Do what you want
              i++;  //i needs to be declared as final
              mProgressBar.setProgress(i); //mProgressBar needs to be declared as final
          }
      };
      mCountDownTimer.start();
  }
  </code></pre>
  
  <p>}</p>