title: am I using boolean wrong?
body: <p>I'm trying to get a button to load a class and set a boolean then when the button is clicked again it loads another class..etc. I don't think it's setting MODE to false after it's done, is something wrong with my code?</p>
  <pre><code>        Button button = findViewById(R.id.button);
          button.setOnClickListener(new View.OnClickListener() {
              boolean darkMode = false;
              public void onClick(View v) {
                  if(!darkMode){
                      injectCSSdark();
                      darkMode = true;
                  } else {
                      injectCSS();
                      darkMode = false;
                  }
  
              }
          });
  </code></pre>
  <p>Debug code:</p>
  <pre><code>    Button button = findViewById(R.id.button);
      button.setOnClickListener(new View.OnClickListener() {
          boolean darkMode = false;
          public void onClick(View v) {
                  Log.d(&quot;mode&quot;, &quot;onClick: 1 &quot; + darkMode);
              if(!darkMode){
                  injectCSSdark();
                  darkMode = true;
                  Log.d(&quot;mode&quot;, &quot;onClick: 2 &quot; + darkMode);
              } else {
                  injectCSS();
                  darkMode = false;
                  Log.d(&quot;mode&quot;, &quot;onClick: 3 &quot; + darkMode);
              }
  
          }
      });
  </code></pre>
  <pre><code>private void injectCSS() {
          try {
              Log.d(&quot;mode&quot;, &quot;injectCSS!&quot;);
              InputStream inputStream = getAssets().open(&quot;style.css&quot;);
              byte[] buffer = new byte[inputStream.available()];
              inputStream.read(buffer);
              inputStream.close();
              String encoded = Base64.encodeToString(buffer, Base64.NO_WRAP);
              wv.loadUrl(&quot;javascript:(function() {&quot; +
                      &quot;var parent = document.getElementsByTagName('head').item(0);&quot; +
                      &quot;var style = document.createElement('style');&quot; +
                      &quot;style.type = 'text/css';&quot; +
                      // Tell the browser to BASE64-decode the string into your script !!!
                      &quot;style.innerHTML = window.atob('&quot; + encoded + &quot;');&quot; +
                      &quot;parent.appendChild(style)&quot; +
                      &quot;})()&quot;);
              Log.d(&quot;mode&quot;, &quot;injectCSS! end&quot;);
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  <p>injectCSSDark is the same just different name.</p>