首页 > 解决方案 > 我想在 Android Studio 中从我的 SQLite 数据库中删除一些东西

问题描述

嘿,我想用一个按钮从我的数据库中删除一些东西。但是当我按下按钮时,这个错误来了:

12-20 14:25:27.897 19233-19233/com.example.corona_anwesenheitsliste W/System: ClassLoader referenced unknown path: /data/app/com.example.corona_anwesenheitsliste-1/lib/arm64

12-20 14:25:27.951 19233-19233/com.example.corona_anwesenheitsliste W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter 
androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable

12-20 14:25:27.992 19233-19233/com.example.corona_anwesenheitsliste I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>

12-20 14:25:27.992 19233-19233/com.example.corona_anwesenheitsliste I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>

12-20 14:25:28.057 19233-19233/com.example.corona_anwesenheitsliste I/HwSecImmHelper: mSecurityInputMethodService is null

12-20 14:25:28.066 19233-19233/com.example.corona_anwesenheitsliste E/HAL: load: id=gralloc != hmi->id=gralloc

12-20 14:25:28.091 19233-19252/com.example.corona_anwesenheitsliste E/HAL: load: id=gralloc != hmi->id=gralloc

12-20 14:25:28.092 19233-19252/com.example.corona_anwesenheitsliste I/OpenGLRenderer: Initialized EGL, version 1.4

12-20 14:25:28.096 19233-19252/com.example.corona_anwesenheitsliste W/OpenGLRenderer: load: so=/system/lib64/libhwuibp.so
    dlopen failed: library "/system/lib64/libhwuibp.so" not found

12-20 14:25:28.096 19233-19252/com.example.corona_anwesenheitsliste W/OpenGLRenderer: Initialize Binary Program Cache: Load Failed

12-20 14:25:28.097 19233-19252/com.example.corona_anwesenheitsliste E/HAL: load: id=gralloc != hmi->id=gralloc

12-20 14:25:28.177 19233-19233/com.example.corona_anwesenheitsliste I/HwSecImmHelper: mSecurityInputMethodService is null

12-20 14:25:28.178 19233-19233/com.example.corona_anwesenheitsliste I/HwSecImmHelper: mSecurityInputMethodService is null

这是“删除方法”的代码:

public void deleteName(int id, String name) {
    SQLiteDatabase db = this.getWritableDatabase();

    String query = "DELETE FROM " + TABLE_NAME + " WHERE "
            + COL1 + " = '" + id + "'" +
            "NAME" + COL2 + " = '" + name + "'" ;
    Log.d(TAG, "deleteID: query: " + query);
    Log.d(TAG, "deleteName: Deleting " + name + " from database");
    db.execSQL(query);
}

什么是正确的删除语句?

标签: javaandroid

解决方案


推荐阅读