I want send data to javascript to show in my html page.
This is my java code to create json but I don't know how can I convert my string variable to json object and how get that in to javascript:
public void ReadDB()
{
final SQLiteDatabase mydatabase1 = openOrCreateDatabase("CopyCollection", MODE_PRIVATE, null);
//==================== Read Database =========================
String tmp = "";
Cursor c = mydatabase1.rawQuery("SELECT * FROM Details ", null);
if(c.moveToFirst()){
do{
String id = c.getString(0);
String app = c.getString(1);
String txt = c.getString(2);
String text_time = c.getString(3);
tmp += "{ID:"+id+",App:'"+app+"',Content:'"+txt+"',Date:'"+text_time+"'},";
}while(c.moveToNext());
}
JsonTxt = "["+tmp+"]";
c.close();
mydatabase1.close();
}
Aucun commentaire:
Enregistrer un commentaire