title: Android EditText to int in inner class
body: <p>So I'm getting one tricky problem when trying to decrement value of EditText. Let me explain, I have some CountDownTimers and when second timer gets to the end a value that's setted before needs to be decremented so the timers won't repeat infinite amount of times.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public void poslijeDelaya() {
  
                  int counterInt = Integer.parseInt(editTextNOI.getText().toString());
  
                  if (counterInt &gt; 0) {
  
  
                      String tekstTrci = editTextHIIVrijeme.getText().toString();
                      long longTrci = Long.parseLong(tekstTrci);
  
                      CountDownTimer timerTrci = new CountDownTimer(longTrci * 1000 + 100, 1000) {
                          @Override
                          public void onTick(long millisUntilFinished) {
                              updateTimer((int) millisUntilFinished / 1000);
  
                          }
  
                          @Override
                          public void onFinish() {
                              textViewGlavniTimer.setText("00:00");
                              textViewNatpisZaOpisAktivnosti.setText(getResources().getString(R.string.liiState));
  
                              String tekstHodaj = editTextLIIVrijeme.getText().toString();
                              long longHodaj = Long.parseLong(tekstHodaj);
  
                              CountDownTimer timerHodaj = new CountDownTimer(longHodaj * 1000 + 100, 1000) {
                                  @Override
                                  public void onTick(long millisUntilFinished) {
                                      updateTimer((int) millisUntilFinished / 1000);
                                  }
  
                                  @Override
                                  public void onFinish() {
                                      counterInt --;
                                      textViewGlavniTimer.setText("00:00");
                                      textViewNatpisZaOpisAktivnosti.setText(getResources().getString(R.string.hiiState));
                                      poslijeDelaya();
  
                                  }
                              }.start();
  
                          }
                      }.start();
                  } else {
                      textViewNatpisZaOpisAktivnosti.setText("Done");
                  }
              }
          });
  </code></pre>
  
  <p>The tricky part is on <code>counterInt --;</code> part. It says that the variable needs to be declared as final because it's accessed from inner class so I set <code>int counterInt = Integer.parseInt(editTextNOI.getText().toString());</code> to <code>final int counterInt = Integer.parseInt(editTextNOI.getText().toString());</code> and guess what?</p>
  
  <p>It says that it can't assign value to a final variable.</p>
  
  <p>Any ideas on how to make Android Studio to stop trolling me?</p>