Am developing one apps开发者_JAVA百科 using sqlite.I created database in main Activity ,I created that database in the "MODE_WORLD_WRITEABLE" mode.I can only access this database within alone that activity only,but i need to use same database for all activity.What can i do for single database for all the activity accessible within that application.I don't know how to proceed that . this is my first apps using sqlite,So anyone help me to fix this problem?
Thanks
you should create SQLiteOpenHelper
using activity.getApplicationContext()
.
Now you open the database using the activity context, so it is available only for your activity. If you open your db using application context, it will be reachable from any activity of your application.
精彩评论