title: Android: addview not work in thread ( for while )
body: <p>I use below code for addview</p>
  
  <pre><code>final LinearLayout screenRL = (LinearLayout) findViewById(R.id.screenRL);
  new Thread(new Runnable() {
  
              @Override
              public void run() {
  
                          for (int i = 0; i &lt; 4; i++) {
  
                                      LayoutInflater inflater = getLayoutInflater();
                                      final View view = inflater.inflate(R.layout.dl, null);
  
                                      TextView txtTitleView = (TextView) view.findViewById(R.id.txtTitleView);
                                      txtTitleView.setText((i + 1) + ". Post");
  
                                      Log.i("Check", "Before : ");
  
                                      runOnUiThread(new Runnable() {
  
                                                  public void run() {
                                                              Log.i("Check", "After");
                                                              screenRL.addView(view);
  
                                                  }            
                                       });
                          }
              }
  }).start();
  
  Log.i("Check", "Screen");
  </code></pre>
  
  <p>After run this code , Logged is :</p>
  
  <pre><code>Before
  Screen
  After
  </code></pre>
  
  <p>But i want it :</p>
  
  <pre><code>Before
  After
  Screen
  </code></pre>
  
  <p>Actually runOnUiThread run after Thread is finish</p>
  
  <p>But i want addView work in thread</p>