我的提供者是
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
if(uriMatcher.match(uri) == TEXTS_ID)
selection = DBOpenHelper.text_ID + "=" + uri.getLastPathSegment();
return database.query(DBOpenHelper.TABLE_textS, DBOpenHelper.ALL_COLUMNS, selection, selectionArgs, null, null,DBOpenHelper.text_CREATED + " DESC");
}
我称之为:
String [] cursorArgs = new String [] {"0"};
String selection = "textId=";
return new CursorLoader(this, textsProvider.CONTENT_URI, null, selection, cursorArgs, null);
如你所见,我想在textId = 0
时发短信Caused by: android.database.sqlite.SQLiteException: near "ORDER": syntax error (code 1): , while compiling: SELECT _id, textId, textText, textCreate FROM texts WHERE textId= ORDER BY textCreated DESC
答案 0 :(得分:0)
在SQLite
之后,?
的选择必须为=
,因此请尝试
String selection = "textId=?";