SqlLiteDatabaseLockedException in android database helper class -


i've helper class manages database queries throughout application. singleton class , getinstance() method.

public static masterdatabase getinstance() {     if (_masterdb == null) {         _masterdb = new masterdatabase();     }     return _masterdb;  } 

though i've taken care 1 instance of class created, sqllitedatabaselockedexception message database locked. thought of implementing double-checked locking technique appears may brake in multicore environments. so, best implementation ensure exception wont repeat in application.

note: other transaction methods(insert,delete,..) not synchronised.

question2 : making transaction methods synchronised good?

if using android-s databasehelper database may opened databasehelper.

try this

private static databasehelper _mydatabasehelper = null;  public static masterdatabase getinstance() {     if (_mydatabasehelper == null) {         _mydatabasehelper = new mydatabasehelper();     }     return _mydatabasehelper..getwritabledatabase(); } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -