[Android] Initialize the SQLite database earlier

Ludovic Fauvet git at videolan.org
Mon Jun 24 12:13:08 CEST 2013


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Jun 24 12:01:59 2013 +0200| [e5a66cdd9bf697e774815deeae11463ef2f04b23] | committer: Ludovic Fauvet

Initialize the SQLite database earlier

This is a blind attempt to fix some of the now common "SQLiteException:
unable to open database file". It should avoid any race condition that
can occur between the UI and the Service while opening (and creating)
the database.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e5a66cdd9bf697e774815deeae11463ef2f04b23
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 2be3709..604d592 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -70,6 +70,9 @@ public class VLCApplication extends Application {
                     getBaseContext().getResources().getDisplayMetrics());
         }
 
+        // Initialize the database soon enough to avoid any race condition and crash
+        MediaDatabase.getInstance(this);
+
         instance = this;
     }
 



More information about the Android mailing list