Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid sqlite unrecognized token exception
    primarykey
    data
    text
    <p>I am trying to fetch some data in my android code from sqlite table.I am getting an unrecognized token exception. Kindly help. This is the relevant portion of my code:</p> <pre><code>private static final String APPS_CREATE = "create table applist (" + "_id integer primary key, " + "deviceid int(10) not null," + "catid int(10)," + ............ private static final String APPCNT_CREATE = "create table appcntlist (" + "_id integer primary key, "+ "appcntid int , " + "cntappid int);"; ......................... public Cursor fetchCntNotes(String cnt){ Cursor appfinlist=null; Cursor temp=mDb.query(CNT_TABLE, new String[]{KEY_ROWID}, KEY_CNTNM + "=\"" + cnt + "\"", null, null , null, null); Cursor applist; if(temp.moveToFirst()){ id=temp.getInt(temp.getColumnIndexOrThrow(DbAdapter.KEY_ROWID)); Log.d("amit","countryname id: "+ id); applist=mDb.rawQuery("SELECT appcntid FROM appcntlist WHERE cntappid = "+id, null); if(applist.moveToFirst()){ int[] cntin=new int[applist.getCount()]; for(int i=0;i&lt;applist.getCount();i++){ Log.d("amit","countryname id appid: " + applist.getInt(applist.getColumnIndexOrThrow(DbAdapter.KEY_APPCNTID))); cntin[i]=applist.getInt(applist.getColumnIndexOrThrow(DbAdapter.KEY_APPCNTID)); Log.d("amit","countryname id cnt var: " + cntin[i]); applist.moveToNext(); } appfinlist = mDb.rawQuery("SELECT * FROM applist WHERE _id IN "+cntin+")", null); return appfinlist; } </code></pre> <p>This is the relevant portion of logcat</p> <p>E/AndroidRuntime(6447): Caused by: android.database.sqlite.SQLiteException: unrecognized token: "[I@406488d0)": , while compiling: SELECT * FROM applist WHERE _id IN [I@406488d0)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload