I'm getting this error on parsing my JSON data into a list view.
Error Parsing Value:
my code
I have my Arraylist which is going to a list_item view.
I don't know why it's not showing up.
I'm coming to this line after that it's nothing showing anymore
Error Log:
Error Parsing Value:
my code
Code:
@Override
protected Void doInBackground(Void... params) {
HttpHandler sh = new HttpHandler();
String url = "my link";
String jsonStr = sh.makeServiceCall(url);
Log.e(TAG, "Response from URL:" + jsonStr);
if (jsonStr != null){
try {
JSONObject jsonObject = new JSONObject(jsonStr);
I have my Arraylist which is going to a list_item view.
I don't know why it's not showing up.
Code:
JSONArray mandant = jsonObject.getJSONArray("get_schedule_data_employee");
for (int i = 0; i < mandant.length(); i++){
JSONObject m = mandant.getJSONObject(i);
String name = m.getString("firstname");
String schift = m.getString("schift");
JSONObject phone = m.getJSONObject("schift");
String remark = phone.getString("remark");
String home = phone.getString("mandator");
String office = phone.getString("mandator");
HashMap <String, String> mandants = new HashMap<>();
mandants.put("schift", schift);
mandants.put("firstname", name);
mandants.put("remark", remark);
mandants.put("mandator", home);
mandants.put("mandtaor", office);
mandantList.add(mandants);
}
}
I'm coming to this line after that it's nothing showing anymore
Code:
catch (final JSONException e){
Log.e(TAG, "Json ERROR" + e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),"JSON PARSING ERROR" + e.getMessage(),Toast.LENGTH_LONG).show();
}
});
}
}else
{
Log.e(TAG, "JSON Verbindung mit Server nicht möglich");
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),"JSON Verbindung mit Server konnte nicht hergestellt werden, versuchen Sie es über LOGCAT", Toast.LENGTH_LONG).show();
}
});
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
ListAdapter adapter = new SimpleAdapter(MainActivity.this, mandantList, R.layout.list_item, new String[]{"firstname","schift"}, new int[]{R.id.name, R.id.schift});
lv.setAdapter(adapter);
}
}}
Error Log:
Code:
03-17 14:52:45.707 28585-28663/com.example.cicajos.testlist E/MainActivity: Response from URL:
03-17 14:52:45.733 28585-28663/com.example.cicajos.testlist E/MainActivity: Json ERRORValue [{"mandator_id":"1","mandator":"WG ","department_id":"22","department":"WG ","employee_id":"1111","firstname":"Firstname","surname":"Surname","shortname":"","