title: Android Runnable class - cannot access property from run() method
body: <pre><code>  class MyRunnable implements Runnable{
          public StringBuffer line2;
          public MyRunnable(StringBuffer _line){
               this.line2 = _line;
               Log.w("LINE", this.line2.toString());   // Return what it should
          }
  
          public void run(){
               console.append(this.line2.toString());   //Nothing happens here
          }
    }
  </code></pre>
  
  <p>This is my code. I have the problem that when accessing line2 from <code>run()</code> method it has 0 length. </p>
  
  <p><strong>edit</strong>: This is my call</p>
  
  <pre><code>        new Thread(new Runnable() {             
              @Override
              public void run() {
                  StringBuffer line = new StringBuffer();
                  while(true){
                      char a = UART.serialRead(UART.fd);
  
                      if(a != 0){                         
                          if (a == '\r' || a == '\n'){
                              MyRunnable obj = new MyRunnable(line);
                              handler.post(obj);
                              line.delete(0, line.length());
                              obj = null;
                          }else
                              line.append(a); 
                      }                   
  
                      try {
                          Thread.sleep(50);
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                  }
  
              }
          }).start();
  </code></pre>
  
  <p>Any idea where I'm wrong?</p>