title: How can Runnable modify a final local variable
body: <p>I was trying to find out when my user interface is running and had the clever idea of posting a runnable to the uiThread whose only job would be to set a flag.  I tried to use a <code>volatile</code> keyword on <code>uiIsRunning</code> but eclipse won't allow that and I don't understand that yet.  </p>
  
  <p>But what is amazing to me is when I tried the code below without the final modifier on <code>uiIsRunning</code>, I was told correctly that I could only use a local variable in an embedded class if that local variable is <code>final</code>.  So I made <code>uiIsRunning final</code> and much to my surprise, Eclipse is totally fine with my line <code>uiIsRunning = true;</code>, that is Eclipse thinks it is fine for me to be setting the value of my <code>final</code> variable inside this nested class!</p>
  
  <p>If anybody can tell me what I need to do to get the action I want: set a flag to false in my current thread which is then set to true when the thread I am posting it to executes it, I would be grateful.  </p>
  
  <pre><code>        final boolean uiIsRunning = false;
          uiHandler.post(new Runnable() {
              @Override
              public void run() {
                  uiIsRunning = true;
              }
          });
  </code></pre>