title: Is not possible to acess a class variable inside a handler?
body: <p>I have a global boolean variable on my class, and also i have a handler on my class. I want that the handler does some code only when that variable of the class is true, but it is not working, because for the handler that variable is ALWAYS false. I dont understand why, because that value is true sometimes, i checked it with a log of the variable value, but for the handler is always false.</p>
  
  <p>This is some example code of what im doing:</p>
  
  <p>my class global variable, i tryed it with and without private and with and without static modifier:</p>
  
  <pre><code>private boolean cancelTimers;
  </code></pre>
  
  <p>in some part of my code i do this:</p>
  
  <pre><code>cancelTimers=true;
  </code></pre>
  
  <p>my handler:</p>
  
  <pre><code>    hand=new Handler(){
          @Override
          public void handleMessage(Message msg) {
              if(cancelTimers==true){
                  System.out.println("handler canceled");
                  return;
              }else{
                  System.out.println("handler done");
                  super.handleMessage(msg);   
              }           
         }
      };
  </code></pre>
  
  <p>The problem is that for my handler, cancelTimners is always false, even when the variable is true, because i am writting his value before calling the handler.</p>