I have created a database by extending SQLiteOpenHelper
class. And its created also. This is code I am pasting
public Imagehelper(Context context) { super(context, DATABASE_NAME, null, SCHEMA_VERSION); cntxt = context; filename = Environment.getExternalStorageDirectory(); DATABASE_FILE_PATH_EXTERNAL = filename.getAbsolutePath()+File.separator+DATABASE_NAME; Log.i("Log", ":"+DATABASE_FILE_PATH_EXTERNAL); }
Here everything is working fine. But if you focus on the parameters pass in super super(context, DATABASE_NAME, null, SCHEMA_VERSION); . I am not able to understand the null parameter. I know here we have to pass the SQLiteDatabase.CursorFactory object.
But how?? And what is the use of that??
The reason of passing null is you want the standard SQLiteCursor
behaviour. If you want to implement a specialized Cursor
you can get it by by extending the Cursor class
( this is for doing additional operations on the query results). And in these cases, you can use the CursorFactory
class to return an instance of your Cursor implementation. Here is the document for that
SQLiteDatabase.CursorFactory DOC
Used to allow returning sub-classes of Cursor when calling query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With