From af0426e01bebcc9088d90d76e59107042a58f406 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 31 Oct 2017 16:52:15 +0100 Subject: a little rewrite in WelcomeActivity --- .../java/de/pixart/messenger/ui/WelcomeActivity.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java index b34cc22ae..6c0f38363 100644 --- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java +++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java @@ -41,6 +41,8 @@ import de.pixart.messenger.utils.EncryptDecryptFile; public class WelcomeActivity extends XmppActivity { + boolean importSuccessful = false; + @Override protected void refreshUiReal() { } @@ -240,7 +242,17 @@ public class WelcomeActivity extends XmppActivity { } Log.d(Config.LOGTAG, "checkDB = " + checkDB.toString() + ", Backup DB = " + Backup_DB_Version + ", DB = " + DB_Version); if (checkDB != null && Backup_DB_Version != 0 && Backup_DB_Version <= DB_Version) { - ImportDatabase(); + try { + ImportDatabase(); + importSuccessful = true; + } catch (Exception e) { + importSuccessful = false; + e.printStackTrace(); + } finally { + if (importSuccessful) { + restart(); + } + } } else if (checkDB != null && Backup_DB_Version == 0) { WelcomeActivity.this.runOnUiThread(new Runnable() { public void run() { @@ -257,7 +269,7 @@ public class WelcomeActivity extends XmppActivity { } } - private void ImportDatabase() throws IOException { + private void ImportDatabase() throws Exception { // Set location for the db: final OutputStream OutputFile = new FileOutputStream(this.getDatabasePath(DatabaseBackend.DATABASE_NAME)); // Set the folder on the SDcard @@ -277,7 +289,6 @@ public class WelcomeActivity extends XmppActivity { Log.d(Config.LOGTAG, "Delete temp file from " + TempFile.toString()); TempFile.delete(); } - restart(); } private void restart() { -- cgit v1.2.3