im making a listview and using JSONObject for array purposes but im getting this error i dont know how to fix it i dont even know where my exception takes place when i run my program it simply end and doesnt not show any result this is my java file i hope someone can find the exception
@Override
protected ArrayList<TodayDetails> doInBackground(Void... params) {
try {
// Create a new HTTP Client
DefaultHttpClient defaultClient = new DefaultHttpClient();
// Setup the get request
HttpGet httpGetRequest = new HttpGet("http://api.androidhive.info/contacts");
// Execute the request in the client
HttpResponse httpResponse = defaultClient
.execute(httpGetRequest);
// Grab the response
BufferedReader reader = new BufferedReader(
new InputStreamReader(httpResponse.getEntity()
.getContent(), "UTF-8"));
String result = reader.readLine();
JSONObject object = new JSONObject(result);
JSONArray Jarray = object.getJSONArray("contact");
for (int i = 0; i < Jarray.length(); i++) {
JSONObject Jasonobject = Jarray.getJSONObject(i);
today_details = new TodayDetails();
today_details.setId(Jasonobject.getInt("id"));
today_details.setName(Jasonobject.getString("name"));
today_details.setEmail(Jasonobject.getString("email"));
today_details.setAddress(Jasonobject.getString("address"));
today_details.setGender(Jasonobject.getString("gender"));
today_details.setPhone(Jasonobject.getInt("phone"));
today_details.setHome(Jasonobject.getInt("home"));
today_details.setMobile(Jasonobject.getInt("mobile"));
today_details.setOffice(Jasonobject.getInt("office"));
search_results.add(today_details);
}
} catch(Exception e){
e.printStackTrace();
}
return search_results;
}
protected void onPostExecute(ArrayList<TodayDetails> search_results) {
if(WeatherToday.this.pd != null){
WeatherToday.this.pd.dismiss();
}
ArrayList<TodayDetails> today_details = search_results;
list_view_main = (ListView)findViewById(R.id.todaylist);
list_view_main.setAdapter(new TodayListAdapter(getApplicationContext(), today_details));
}
};
}