title: Android Apps: will receive "application not responding" after UIThread block more 5 seconds?
body: <p>On Android Developer Site has said that :  We shouldn't use long operations work in <code>UIThread</code>. Instead, we should do it on another thread. At this site, they still say : </p>
  
  <blockquote>
    <p>if the UI thread is blocked for more than a few seconds (about 5
    seconds currently) the user is presented with the infamous
    "application not responding" (ANR) dialog.</p>
  </blockquote>
  
  <p>To test this statement, I make a proof. Here is my code:</p>
  
  <pre><code>package com.app;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class Example extends Activity{
      TextView  textView;
      @Override 
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          textView = new TextView(this);
          textView.setText("please wait");
          setContentView(textView);
  
      }
  
      @Override
      public void onResume(){
          super.onResume();
          try {
              Thread.sleep(8000);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          textView.setText("end waiting !!!");
      }
  
  }
  </code></pre>
  
  <p>As you see, I make current thread (<code>UIThread</code>) sleep 8 seconds. So, I think, if I run this apps, Android will notice: "application not responding". But, I don't see any error. Program run smoothly (and I see text "end waiting", too).</p>
  
  <p>So,who can explain for me about my code. What wrong thing I have made,please.</p>
  
  <p>thanks :)</p>