Android query feature before adding to database
$2-8 USD/小时
Project Description:
I have a QR List Adapter where I add values (qr code and youtube id) to database:
public void add(String qrcode, String ytid){
ContentValues values = new ContentValues();
[url removed, login to view]([url removed, login to view], qrcode);
[url removed, login to view](DatabaseHelper.YT_ID, ytid);
[url removed, login to view]().insert(YouListContentProvider.CONTENT_URI, values);
QRItem item = new QRItem([url removed, login to view], qrcode, ytid);
[url removed, login to view]().add(item);
notifyDataSetChanged();
}
I want to be able to search the database beforehand and if the values (QRCODE and youtube ID) already exists (the video is already in the database) then not to add them to the list. My database helper looks like this:
@Override
public void onCreate(SQLiteDatabase db) {
[url removed, login to view]("CREATE TABLE " + TABLE_NAME + "("
+ID+" INTEGER PRIMARY KEY, "
+QRCODE+" TEXT, "
+YT_ID+" TEXT )");
PutValues(db);
}
It's a small project and I would like it to be done asap.
项目ID: #4574212