aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-31 16:52:15 +0100
committerChristian Schneppe <christian@pix-art.de>2017-10-31 16:52:15 +0100
commitaf0426e01bebcc9088d90d76e59107042a58f406 (patch)
tree8742ff683bbf83ff004370a2dc8cb2d563b2dc7c /src/main/java/de/pixart/messenger
parent0eba73df9ce05f27385ce50f97bdeb2f30c6ed9d (diff)
a little rewrite in WelcomeActivity
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/ui/WelcomeActivity.java17
1 files changed, 14 insertions, 3 deletions
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() {