This might be a dumb question, but I'm new to SQLite and I can't figure it out. I have 1 table with columns KEY_ROWID , KEY_NAME , KAY_LATITUDE and KEY_LONGITUDE . I want the user to be able to select one and delete it; Can someone give me directions to start? My question is the actual deletion of a line with only its name.
Relevant Code:
public class BeaconDatabase { public static final String KEY_ROWID = "_id"; public static final String KEY_NAME = "beacon_name"; public static final String KEY_LATITUDE = "beacon_lat"; public static final String KEY_LONGITUDE = "beacon_lon"; private static final String DATABASE_NAME ="BeaconDatabase"; private static final String DATABASE_TABLE ="beaconTable"; private static final int DATABASE_VERSION = 1; private DbHelper helper; private final Context context; private SQLiteDatabase db; public BeaconDatabase(Context context) { this.context = context; } public BeaconDatabase open() { helper = new DbHelper(this.context); db = helper.getWritableDatabase(); return this; } public void close() { helper.close(); } public long createEntry(String name, Double lat, Double lon) { ContentValues cv = new ContentValues(); cv.put(KEY_NAME, name); cv.put(KEY_LATITUDE, lat); cv.put(KEY_LONGITUDE, lon); return db.insert(DATABASE_TABLE, null, cv); } public void deleteEntry(long row) {
android sqlite delete-row
roboguy12 Sep 22 2018-11-11T00: 00Z
source share