From: rmceoin Date: Wed, 14 Oct 2009 00:06:20 +0000 (+0000) Subject: OI Safe: in PassList only update adapter data in UI thread X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=c917f54445304d1946dbaba3cce325f37cb0186d;p=android-vcpass-oisafe OI Safe: in PassList only update adapter data in UI thread git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2319 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/PassList.java b/src/org/openintents/safe/PassList.java index 866fc55..78a868a 100644 --- a/src/org/openintents/safe/PassList.java +++ b/src/org/openintents/safe/PassList.java @@ -95,7 +95,11 @@ public class PassList extends ListActivity { private List rows=null; private int lastPosition=0; + + // passDescriptions is updated by the background thread List passDescriptions=new ArrayList(); + // passDescriptions4Adapter must only be modified by the UI thread + List passDescriptions4Adapter=new ArrayList(); 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 entries = new ArrayAdapter(PassList.this, android.R.layout.simple_list_item_1, - passDescriptions); + passDescriptions4Adapter); setListAdapter(entries); if (debug) Log.d(TAG,"lastPosition="+lastPosition); if (lastPosition>2) {