Is it OK to have one instance of SQLiteOpenHelper shared by all Activities in an Android application?

后端 未结 5 1291
谎友^
谎友^ 2020-11-30 19:12

Would it be OK to have a single instance of SQLiteOpenHelper as a member of a subclassed Application, and have all Activities that need an instance of SQLiteDatabase get it

5条回答
  •  渐次进展
    2020-11-30 19:49

    Yes, that is the way you should go about it, having a helper class for the activities that need an instance of the Database.

提交回复
热议问题