title: How to access objects from another thread android
body: <p>This is my MainActivity.java</p>
  
  <pre><code>public class MainActivity extends Activity implements OnItemClickListener {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
   //new thread for communication. 
     Thread communicationThread = new Thread() {
         public void run() {
          Communication communication_object = new Communication();
          communication_object.start();
         }
     };
  
     communicationThread.start();     
      }
  </code></pre>
  
  <p>Communication class implements TCP/IP connection with server and works fine. </p>
  
  <p>But now I need to access that communication object from another activity class - specifically login() method.
  Can I access communication_object.login() running in that thread from another class ?</p>