samedi 26 mars 2016

Android -using SQLiteOpenHelper using two langauge getting id error

i use two language app english , arabic it's work fine in english
but it's return error with arabic


03-26 09:46:11.514 28382-28382/com.pro.fdgdg E/SQLiteLog: (1) no such column: ٤ android.database.sqlite.SQLiteException: no such column: ٤ (code 1): , while compiling: SELECT * FROM photos WHERE store_id = ٤


i use query :


public Photo getPhotoByStoreId(int storeId) {

    Photo entry = null;
    db = dbHelper.getReadableDatabase();

    String sql = String.format("SELECT * FROM photos WHERE store_id = %d", storeId);
    Cursor mCursor = db.rawQuery(sql, null);
    mCursor.moveToFirst();

    if (!mCursor.isAfterLast()) {
        do {

            entry = formatPhoto(mCursor);

        } while (mCursor.moveToNext());
    }
    mCursor.close();
    dbHelper.close();

    return entry;
}

how i think the problem from getting arabic store_id = ٤ so i need to use english id how i can make english is default

Aucun commentaire:

Enregistrer un commentaire