I have a table in database with 7 columns and want to send the column #0 and #6 of all rows to my server as json.
type of column 0 is Long and 6 is string.
my code:
Cursor c = datasource.db.rawQuery("select * from posts ",null);
if (c.moveToFirst()) {
ArrayList<Object> list = new ArrayList<Object>();
do{
Object[] b = new Object[]{c.getLong(0),c.getString(6)};
list.add(b);
} while (c.moveToNext());
JSONArray jsArray = new JSONArray(list);
Log.d("states",jsArray.toString());
}
my desired output is this:
[[123,"hash1"],[125,"hash2"]]
but app gives me this output:
["[Ljava.lang.String;@b212d8b8","[Ljava.lang.String;@b212d998"]