با سلام خدمت اعضای محترم انجمن کلیدستان.
تقاضای کمک دارم ارتون.من یک لیستی دارم که شامل آی دی و اسم و تاریخ و عکس هست.
با استفاده از json از url تونستم دریافتش کنم.ولی چون با حروف فارسی هستند بدرستی نمایش داده نمیشه! خیلی سرچ کردم ولی موفق نشدم.
این هم بخشی از کدی که نوشتم.
کد:
@Override
protected Void doInBackground(Void... params) {
// Create an array
arraylist = new ArrayList<HashMap<String, String>>();
// Retrieve JSON Objects from the given URL address
jsonobject = JSONfunctions
.getJSONfromURL("http://apk.egam.ir/SelectContact.aspx");
try {
// Locate the array name in JSON
jsonarray = jsonobject.getJSONArray("List");
for (int i = 0; i < jsonarray.length(); i++) {
HashMap<String, String> mapp = new HashMap<String, String>();
jsonobject = jsonarray.getJSONObject(i);
// Retrive JSON Objects
//map.put("id", jsonobject.getInt("id"));
mapp.put("name", jsonobject.getString("name"));
mapp.put("family", jsonobject.getString("family"));
mapp.put("date", jsonobject.getString("date"));
mapp.put("image", jsonobject.getString("image"));
// Set the JSON Objects into the array
arraylist.add(mapp);
}
} catch (JSONException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}