<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -9,6 +9,7 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
+import android.os.Handler;
 import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.Menu;
@@ -19,7 +20,7 @@ import android.widget.ListView;
 import android.widget.Toast;
 
 
-public class Browser extends ListActivity {
+public class Browser extends ListActivity implements Runnable {
     private static final String TAG = &quot;DirectoryList&quot;;
 
     private String TEST_NODE    = &quot;http://testgrid.allmydata.org:3567&quot;;
@@ -126,16 +127,41 @@ public class Browser extends ListActivity {
         loadDirectory(cap);
     }
     
-    private void loadDirectory(String cap) {        
+    // Need handler for callbacks to the UI thread
+    final Handler mHandler = new Handler();
+
+    // Create runnable for posting
+    final Runnable mUpdateResults = new Runnable() {
+        public void run() {
+            updateResultsInUi();
+        }
+    };
+
+    protected void startLongRunningOperation() {
+        // Fire off a thread to do some work that we shouldn't do directly in the UI thread
+
+    }
+  
+    protected void loadDirectory(String cap) {
+    	current_cap = cap;
+    	
+        Thread thread = new Thread(this);
+        thread.start();
+    }
+    
+    public void run() {
         try {
-        	current_cap = cap;
-        	dir = tahoe.getDirectory(cap);
+        	dir = tahoe.getDirectory(current_cap);
         	assert dir != null;
         } catch (Exception e) {
-        	Toast.makeText(this, &quot;Cannot access the directory referenced by &quot; + cap, Toast.LENGTH_LONG).show();
+        	Toast.makeText(this, &quot;Cannot access the directory referenced by &quot; + current_cap, Toast.LENGTH_LONG).show();
         	return;
         }
         
+        mHandler.post(mUpdateResults);
+    }
+    
+    private void updateResultsInUi() {
         this.setListAdapter(new ArrayAdapter&lt;String&gt;(
         	this, android.R.layout.simple_list_item_1, dir.toStringArray()));
     }</diff>
      <filename>src/org/allmydata/tahoelafs/Browser.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ae81cf760ef9bd0071b861bfdd5cff72060b31a3</id>
    </parent>
  </parents>
  <author>
    <name>Francois Deppierraz</name>
    <email>francois@ctrlaltdel.ch</email>
  </author>
  <url>http://github.com/ctrlaltdel/TahoeLAFS-android/commit/8476031d53a70b148b6d827ce7fc1e51960b3c7c</url>
  <id>8476031d53a70b148b6d827ce7fc1e51960b3c7c</id>
  <committed-date>2009-09-06T15:05:13-07:00</committed-date>
  <authored-date>2009-09-06T15:05:13-07:00</authored-date>
  <message>Launch network operations in another thread to avoid blocking the UI thread</message>
  <tree>66de67907d8fb3f70d020b7cdf263f258dbed114</tree>
  <committer>
    <name>Francois Deppierraz</name>
    <email>francois@ctrlaltdel.ch</email>
  </committer>
</commit>
