]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: in PassList only update adapter data in UI thread
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 14 Oct 2009 00:06:20 +0000 (00:06 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 14 Oct 2009 00:06:20 +0000 (00:06 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2319 72b678ce-9140-0410-bee8-679b907dd61a

src/org/openintents/safe/PassList.java

index 866fc551e8a7cfe6f5cdd044fb6fce19f1b09d27..78a868a504ab6d9d12b38f7817e83375cd1c2159 100644 (file)
@@ -95,7 +95,11 @@ public class PassList extends ListActivity {
 
     private List<PassEntry> rows=null;
     private int lastPosition=0;
+
+    // passDescriptions is updated by the background thread
        List<String> passDescriptions=new ArrayList<String>();
+       // passDescriptions4Adapter must only be modified by the UI thread
+       List<String> passDescriptions4Adapter=new ArrayList<String>();
 
        public Handler myViewUpdateHandler = new Handler(){
                // @Override
@@ -103,9 +107,11 @@ public class PassList extends ListActivity {
                        switch (msg.what) {
                                case PassList.MSG_UPDATE_LIST:
                                        fillerThread=null;
+                                       passDescriptions4Adapter.clear();
+                                       passDescriptions4Adapter.addAll(passDescriptions);
                                ArrayAdapter<String> entries = 
                                        new ArrayAdapter<String>(PassList.this, android.R.layout.simple_list_item_1,
-                                                       passDescriptions);
+                                                       passDescriptions4Adapter);
                                setListAdapter(entries);
                                        if (debug) Log.d(TAG,"lastPosition="+lastPosition);
                                        if (lastPosition>2) {