开发者

Can't Accsess database in all the activity in my android aplication?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜