compileSdkVersion 23
useLibrary 'org.apache.http.legacy'
Cursor cursor = this.getReadableDatabase().query(tableName, null, "city =?", new String[]{city}, null, null, null); int[] arr = new int[cursor.getCount()];i=0; if(cursor.moveToFirst()){ int id= cursor.getColumnIndex("_id"); do { arr[i] = cursor.getInt(id)); i++; } while (cursor.moveToNext()); }