For some reasons I need to use a json string inside my application .this is the string variable content : please tell me solution When I use my json class to show this varibale,I get ?????? instead of arabic characters .
RequestParams g = new RequestParams();
g.put("ID", ID);
g.put("year", YEAR);
AsyncHttpClient client = new AsyncHttpClient();
client.get("********", *****,
new AsyncHttpResponseHandler(){
@Override
public void onSuccess(String response) {
Marks=new ArrayList<String>();
Subjects=new ArrayList<String>();
DataToShow=new ArrayList<String>();
try {
// JSON Object
JSONObject obj = new JSONObject(response);
Log.d("DATAAAAAAAA", response);
if (obj.getString("status").equals("true")) {
JSONArray co = obj.getJSONArray("names");
JSONObject obj2;
for (int i = 0; i < co.length(); i++) {
obj2 = co.getJSONObject(i);
Marks.add(obj2.getString("subjectmark"));
Subjects.add(obj2.getString("subjectname"));
DataToShow.add(obj2.getString("subjectmark")+":....:"+obj2.getString("subjectname"));
}
MyADApter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, DataToShow);
MYMArksLISTVIEW.setAdapter(MyADApter);
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(),
"Error Occured [Server's JSON response might be invalid] at favorite!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Throwable error, String content) {
Toast.makeText(getApplicationContext(),
"Error Occured [Server's JSON response might be invalid] at favorite!",
Toast.LENGTH_LONG).show();
}
});
Aucun commentaire:
Enregistrer un commentaire