i got this error :
The method query(String, String[], String, String[], String, String, String) in the type SQLiteDatabase is not applicable for the arguments (String, String[], String, String, null, null, null)
and the code responsible:
public Cursor getDomanda(String id) {
List<categorie> categorie = new ArrayList<categorie>();
Cursor cursor = database.query(MySQLiteHelper.TABLE_SONDAGGI,
allCategorieColumns, MySQLiteHelper.COLUMN_ID + "=", id, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
categorie categoria = cursorToCategorie(cursor);
categorie.add(categoria);
cursor.moveToNext();
}
// Make sure to close the cursor
// cursor.close();
return cursor;
}
on the other side:
long strcategory = getIntent().getExtras().getLong("categoriaId");
Cursor values = datasource.getDomanda(Long.toString(strcategory));
what i’m doing wrong?
i need to convert the long to String[] but what the heck is a String[] ?:D
and by the way…is the query right?
i mean
database.query(MySQLiteHelper.TABLE_SONDAGGI,
allCategorieColumns, MySQLiteHelper.COLUMN_ID + "=", id, null, null, null);
is
select from tableSondaggi where _id = $id ?
The 4th parameter must be a
String[], not aString.You need to replace
idbynew String[] { id }to create an array composed of one single element (your id).