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
Post a Comment