title: Handler.post() thread, is crashing application
body: <p>I work on an app, which have two activities. MainActivity have to editext in order to send an IP address and Port with Intent, to the second Activity2. </p>
  
  <p>The problem I have is that when I use <code>Handler.post()</code> in order to update TextView in the UI thread, app crashes. Without handler thread app running correctly. I think that my code is correct but I cannot understand the reason for this problem.</p>
  
  <pre><code>public class Activity2 extends Activity {
  
  private Socket s;
  private OutputStream out = null;
  private PrintWriter w = null;
  private Handler handler = new Handler();
  private TextView textView1;
  private String tag = "ALEX";
  private static String IP;
  private static int port;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity2);
  
      Bundle extras = getIntent().getExtras(); 
      if (extras != null) {
          IP = extras.getString("IP");
          String port2 = extras.getString("PORT");
          port = Integer.parseInt(port2);
          // Log.v("ip",ip);
          // Log.v("port",port);
      }
  
  Runnable runnable = new Runnable() {
          public void run() {
  
              synchronized (this) {
                  try {
                      s = new Socket(IP, port);
                      out = s.getOutputStream();
                      w = new PrintWriter(out);
                  } catch (Exception e) {
                      Log.v("error socket", "Alex soc");
                      e.printStackTrace();
                  }
              }
  
              **handler.post(new Runnable() {
                  @Override
                  public void run() {
                      synchronized (this) {
                          try {
                              Thread.sleep(1000);
                              if (s.isConnected)
                                  textView1.setText("connected...");
                              // textView1.setText("not connected...");
                          } catch (InterruptedException e) {
                              // TODO Auto-generated catch block
                              Log.v("error handler", "handler Alex");
                              e.printStackTrace();
                          }
                      }
                  }
              });**
  
          }
      };
      Thread mythread = new Thread(runnable);
      mythread.start();
  </code></pre>