diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeDatabase.java | 7 | ||||
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/org/madore/android/unicodeMap/UnicodeDatabase.java b/src/org/madore/android/unicodeMap/UnicodeDatabase.java index b0b5c77..c40cf67 100644 --- a/src/org/madore/android/unicodeMap/UnicodeDatabase.java +++ b/src/org/madore/android/unicodeMap/UnicodeDatabase.java @@ -73,6 +73,7 @@ public class UnicodeDatabase { public void populate(Handler progressHandler) { SQLiteDatabase db = dbinit.getWritableDatabase(); + db.beginTransaction(); db.execSQL("DELETE FROM "+UNICODE_TABLE_NAME); AssetManager amgr = activity.getAssets(); SQLiteStatement cmd @@ -116,9 +117,11 @@ public class UnicodeDatabase { throw new AssertionError("US-ASCII encoding unsupported"); } catch (IOException e) { throw new RuntimeException(e); + } finally { + db.endTransaction(); + db.close(); + reportProgress(progressHandler, pieces.length, pieces.length); } - reportProgress(progressHandler, pieces.length, pieces.length); - db.close(); } protected final static String[] queryColumns = { "id", "name", "category" }; diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java index 7d70186..a1917a4 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -44,12 +44,14 @@ public final class UnicodeMapActivity extends ListActivity { progress.setTitle("Loading Unicode database"); progress.setMessage("Please wait"); progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + progress.setCancelable(false); progress.show(); final Handler handler = new Handler() { public void handleMessage(Message msg) { int done = msg.getData().getInt("done"); int total = msg.getData().getInt("total"); - progress.setProgress(done*10000/total); + progress.setMax(total); + progress.setProgress(done); if ( done >= total ) progress.dismiss(); } |