tags:

views:

98

answers:

2

I'm trying to open database as follows : SQLiteDatabase myDatabase; myDatabase = openOrCreateDatabase("sudoku.db", Context.MODE_PRIVATE, null);

This code works fine when I implement it in the Service class, but when I try to implement this in the onPostExecute eventhandler of the GeneraterThread class,implementing AsyncTask, I get the following error :

'The method openOrCreateDatabase(String, int, null) is undefined for the type GeneraterThread'

Kindly explain..I'm a novice in Android

A: 

Use it with your parent class

something like

myService.this.openOrCreateDatabase
Pentium10
A: 

It looks like you're trying to invoke openOrCreateDatabase method on GeneraterThread instance which doesn't have the method (and Service class has the method). You probably may pass in a reference to a Context object and invoke the method on it. Or use static method of SQLiteDatabase.openOrCreateDatabase().

Konstantin Burov