here is the code.
public class DatabaseManager extends android.app.Activity
{
public SQLiteDatabase mydatabase ;
private static final Object MODE_PRIVATE = null;
public static final String TABLE_NAME = "Fests";
// this function is called first.
public void createDatabase()
{
try{
mydatabase = openOrCreateDatabase("fests",SQLiteDatabase.CREATE_IF_NECESSARY,null);
System.out.println("no probs with open function.");
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS Fests (FestId VARCHAR,Festname VARCHAR);");
}catch(Exception e)
{
Log.d("creating db","exception caught."+e);
}
}
I am getting null pointer exception in the first line itself i.e. openOrCreateDatabase function, unable to figure out why. I am new to android programming.Please help me.