I'm a new comer to Android development and want to create and pre-populate a SQLite database using csv files in the Assets folder. I'm utilizing a database adapter class as well as in the onCreate method after creating the database I wish to browse the csv file fromt the assets folder and employ it to place rows using DatabaseUtils.InsertHelper.

import android.database.DatabaseUtils.InsertHelper; 
//... 

public void onCreate(SQLiteDatabase db) {
    db.execSQL(DATABASE_CREATE);

    // need to read the path csv data here containing columns "_id" and "path"

    try {
        InputStream is = getAssets().open("pathcsv"); 

        int size = is.available();

        // Read the entire asset into a local byte buffer.
        byte[] buffer = new byte[size];
        is.read(buffer);
        is.close();

        // Convert the buffer into a string.
        String text = new String(buffer);

    } catch (IOException e) {
        // Should never happen!
        throw new RuntimeException(e);
    }


    // Create a single InsertHelper to handle this set of insertions. 
    InsertHelper ih = new InsertHelper(db, "path_table"); 

    // Get the numeric indexes for each of the columns that we're updating 
    final int id_Column = ih.getColumnIndex("_id"); 
    final int path_Column = ih.getColumnIndex("path"); 

    while (moreRowsToInsert) { 
        // ... Create the data for this row (not shown) ... 

        // Get the InsertHelper ready to insert a single row 
        ih.prepareForInsert(); 

        // Add the data for each column 
        ih.bind(id_Column, idData); 
        ih.bind(path_Column, pathData); 

        // Insert the row into the database. 
        ih.execute(); 
    } 
} 
//... 


} 

I get an eclipse error around the getAssets() line saying :

-The method getAssets() is undefined for the type DatabaseHelper 

I can not appear to obtain context working whatsoever, any help could be appreciated.

Update:

I ought to have incorporated all the code, that is :

private static class DatabaseHelper extends SQLiteOpenHelper {

    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);} 

    @Override
    public void onCreate(SQLiteDatabase db) {
           db.execSQL(PATH_TABLE_CREATE);
           try {
               InputStream is = getAssets().open("@string/path");  

    // the rest is as in my first post above.... 

Basically include a context the following I recieve a mistake:

private static class DatabaseHelper extends SQLiteOpenHelper {

    private Context myContext; 

    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);} 

    @Override
    public void onCreate(SQLiteDatabase db, Context context) {
           db.execSQL(PATH_TABLE_CREATE);
           myContext = context; 
           try {
               InputStream is = myContext.getAssets().open("@string/path");  

    // the rest is as in my first post above.... 

The mistake I recieve is:

The method onCreate(SQLiteDatabase, Context) of type DQDbAdapter.DatabaseHelper must   override or implement a supertype method 

Please are you able to assist me to to solve this error. Thanks

Must you populate the database inside your application, or would you prepare it in advance? See here:

Populate Android Database From CSV file?

If you want to complete what you are attempting to do within the code you published, you could do this something similar to this:

public class DatabaseHelper extends SQLiteOpenHelper {
...
    private Context context;

    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        ...
        context.getAssets()...
    }