Change Variables in inner class
<p>So, my problem is that... I'm a beginner with java and android.
What I want to do is let the boolean "active" become "true", when the first button is clicked (the thread is necessary for an other part of the code)
then, when the second button is clicked &amp; active == true, Player1Score becomes +1.
So the problem is that i can't use non-final variables in the thread &amp; my onClickListener, but I can't use final variables because i need to change them in the code.
If possible please give beginner-friendly answers, thanks!</p>

<pre><code>    [...]
    boolean active;
    int Player1Score, Player2Score;

    Player1Score = 0;
    Player2Score = 0;


    Button button_launch = (Button) findViewById(R.id.button_launch);
    button_launch.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            [...]

            new Thread(new Runnable() {
                public void run() {
                    [...]

                    active = true;

                }

            }).start();

        }
    });

    [...]

    Button button_player1 = (Button) findViewById(R.id.button1);
    button_player1.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            if(active == true){

                Player1Score++;
            }
        }
    });
</code></pre>
