just a simple error I have but I am really having a hard time trying to solve this problem. why is this getContext()
are not applied?
public void ClearRecentPlayer() {
mDbHelper = new DataConn(getContext()); //<---getContext() in redline(not applied)
SQLiteDatabase db = mDbHelper.getWritableDatabase();
ContentValues v = new ContentValues();
v.put(FeedReaderContract.FeedEntry.COLUMN_NAME_STATS, 0);
String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_STATS + " = ?";
String[] selectionArgs = { "0" };
int c = db.update(
FeedReaderContract.FeedEntry.TABLE_NAME_PLAYER,
v,
selection,
selectionArgs);
}
and with this...
public class DataConn extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "db_egame.db";
DataConn mDbHelper;
public DataConn(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_EASY_ENTRIES);
db.execSQL(SQL_CREATE_HARD_ENTRIES);
db.execSQL(SQL_CREATE_DIFF_ENTRIES);
db.execSQL(SQL_CREATE_PLAYER_ENTRIES);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(SQL_DELETE_EASY_ENTRIES);
db.execSQL(SQL_DELETE_HARD_ENTRIES);
db.execSQL(SQL_DELETE_DIFF_ENTRIES);
db.execSQL(SQL_DELETE_PLAYER_ENTRIES);
onCreate(db);
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onUpgrade(db, oldVersion, newVersion);
onCreate(db);
}