samedi 24 janvier 2015

unhandled exception org.json.jsonexception

I, i work for an android app, the app must save a java object in json format into the SQLite database, i write the code for this operation, then they must extract the Json object and reconverting it in a Java Object. When I try to call the method for deserialize the json object in to a string i found this error in Android Studio:unhandled exception org.json.jsonexception


When I try to catch JSONException e the program run but don't deserialize the json object.


this is the code of the method:



private void read() throws JSONException {
SQLiteDatabase db = mMioDbHelper.getWritableDatabase();
String[] columns = {"StringaAll"};
Cursor c = db.query("Alle", columns, null, null, null, null,null );
while(c.moveToNext()) {
String stringaRis = c.getString(0);
JSONObject jObj = new JSONObject(stringaRis);
String sPassoMed = jObj.getString("passoMed");
final TextView tView = (TextView) this.findViewById(R.id.mainProvaQuery);
tView.setText(sPassoMed);
// }
}
}


Can you help me please?


Aucun commentaire:

Enregistrer un commentaire