runonuithread is not working in android
<p>my working task is to read sd card files and i want to show all sdcard files with location on textview but,my code is reading successfully but,i can't update textview text while reading files is not working after i find solution runonuithread but,it's also not working.my code is shown below:</p>

<pre><code>public void scan (final File path) {

            try
            {
                for (final File f : path.listFiles()) {
                    if (f.isFile()) {
                      scannedfiles=scannedfiles+1;
                      progresspercentage=scannedfiles*100/FilesCount;   


                      MainActivity.this.runOnUiThread(new Runnable() {

                          @Override
                          public void run() {
                              lbl_scan.setText("SCANING:"+f.getAbsolutePath());\\first time only change text after didn't change
                              Toast.makeText(getApplicationContext(),"Files:"+f.getAbsolutePath(),Toast.LENGTH_SHORT).show(); 
                          }
                      });


                    }
                    else {
                        if(!f.getName().equals("Android"))
                        {
                            scan(f);
                        }
                    }
                }

            }
            catch (Exception e) 
            {

            }
        }
</code></pre>

<p>i am calling scan function below code:</p>

<pre><code> File root = new File (Environment.getExternalStorageDirectory().getAbsolutePath());
 scan(root);
</code></pre>

<p>can any one help me greatly appreciated.</p>
