Getting context in onCreate in SQLiteOpenHelper

In my android app. How to access context in onCreate method for SQLiteOpenHelper?

+8
android sqliteopenhelper
source share
2 answers

You extend SQLiteOpenHelper and save it in a field in your own constructor. Then, later in onCreate() you have access to the context.

+8
source share

You can extend this class and pass the context to the constructor, which stores it inside the variable. Then you can access it from the onCreate method.

+1
source share

All Articles