由于某些原因,我需要在我的应用程序中使用json字符串。这是字符串变量内容: 请告诉我解决方案 当我使用我的json类来显示这个varibale时,我得到了??????而不是阿拉伯字符。
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();
}
});