/** * Parses the result from JSON and then displays the list of results * * @param results A list containing the results title * @param results2 Beans of the items */ private void parseAndDisplayResult(ArrayAdapter<String> results, final List<MapItem> results2) { if (results != null && results.getCount() == 1 && results2 != null && results2.size() > 0) { startMapActivity(results2.get(0)); finish(); } ListView lv = getListView(); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (results2 != null && results2.size() > 0) { try { MapItem meb = results2.get(position); startMapActivity(meb); } catch (Exception e) { } } } }); mLayout.hideText(); setListAdapter(results); }