@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /* pDialog = new ProgressDialog(getActivity()); // Showing progress dialog before making http request pDialog.setMessage("Loading..."); pDialog.show(); */ try { jsonObject = new JSONObject(json); JSONArray speakerJson = jsonObject.getJSONArray("speakers"); speakerList = Speaker.fromJson(speakerJson); } catch (JSONException e) { e.printStackTrace(); } View rootView = inflater.inflate(R.layout.fragment_speakers, container, false); listView = (ListView) rootView.findViewById(R.id.listview_speakers); adapter = new CustomListAdapter(getActivity(), speakerList); listView.setAdapter(adapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Speaker s = adapter.getItem(position); String[] sd = new String[5]; sd[0] = s.getName(); sd[1] = s.getTitle(); sd[2] = s.getPicture(); sd[3] = s.getLines(); sd[4] = s.getSpeech(); Intent intent = new Intent(getActivity(), SpeakerDetailActivity.class); intent.putExtra("speaker", sd); startActivity(intent); } }); // Inflate the layout for this fragment // TODO: Check for internet conection, otherwise show default image // TODO: Show loading icon while loading image return rootView; }