title: android statement do not execute after setText in TextView
body: <p>i am developing a small application in android. my activity_main consists of three things Button ,TextView and ImageView </p>
  
  <p>and here is the code of main activity</p>
  
  <pre><code>package com.example.shiv.facedetection;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.media.FaceDetector;
  import android.media.FaceDetector.Face;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
      public void onthetapbuttonclick(View View){
          Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          startActivityForResult(intent, 0);
      }
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          // TODO Auto-generated method stub
          super.onActivityResult(requestCode, resultCode, data);
          try{
              Bitmap bp = (Bitmap) data.getExtras().get("data");
              ImageView iv = (ImageView)findViewById(R.id.iv1);
  
              Bitmap bitmap565 = bp.copy(Bitmap.Config.RGB_565, true);
  
  
              if((1==(bitmap565.getWidth()%2))){
                  bitmap565 = Bitmap.createScaledBitmap(bitmap565,
                          bitmap565.getWidth()+1, bitmap565.getHeight(), false);
              }
  
  
  
  
              FaceDetector fd = new FaceDetector(bitmap565.getWidth(),bitmap565.getHeight(), 4);
              Face[] faces =new Face[4];
              int i =fd.findFaces(bitmap565, faces);
              TextView tv =(TextView)findViewById(R.id.text1);
  
              if(i&gt;0){
                  iv.setImageBitmap(bp);
                  System.out.println("face ////////////////detectecd");
                  tv.setText("faces detected "+i);
              }
              else{
                  iv.setImageBitmap(bp);
                  System.out.println("no face ////////////////detectecd");
                  tv.setText("No face detected");
                  System.out.print("hello world");
              }
  
          }catch(Exception e ){
              System.out.println("exception occured");
          }
  
  
      }
  }
  </code></pre>
  
  <p>and activity_main is</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      &gt;
  
      &lt;Button
          android:layout_height="wrap_content"
          android:layout_width="fill_parent"
          android:text="click to take the photo"
          android:id="@+id/button"
          android:onClick="onthetapbuttonclick"/&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:id="@+id/text1"
          android:text="status"/&gt;
  
      &lt;ImageView
          android:layout_height="fill_parent"
          android:layout_width="fill_parent"
          android:id="@+id/iv1"
          android:contentDescription="taken photo"
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>now problem is when i click the image every thing work pretty fine.
  if a face is detected then it will show the face detected + number of faces in the TextView and set the clicked pic in the ImageView and will print no face detected if face is not detected, but after that no statement is getting executed.
  e.g in "no face ////////////////detected" is getting printed but "hello world " is not getting printed.
  I have tried updating the TextView using a Thread. but problem persists 
  I have tested it many times and both android studio for linux as well as for windows. Kindly help</p>