@Override public void onListItemClick(ListView l, View v, int position, long id) { Divesite c = ((DiveSiteAdaptor) getListAdapter()).getItem(position); // Start CrimePagerActivity with this crime Intent i = new Intent(getActivity(), DivesiteActivity.class); i.putExtra(DivesiteActivity.EXTRA_SITE_ID, c.getId()); startActivity(i); }
@Override public View getView(int position, View convertView, ViewGroup parent) { // If we weren't given a view, inflate one if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_divesite, null); } // Configure the view for this DiveSite Resources resources = mContext.getResources(); Divesite c = getItem(position); TextView titleTextView = (TextView) convertView.findViewById(R.id.divesite_titleTextView); titleTextView.setText(c.getName()); titleTextView.setAlpha(87); TextView depthTextView = (TextView) convertView.findViewById(R.id.divesite_depthTextView); depthTextView.setText(c.getMaxDepth()); depthTextView.setAlpha(54); ProportionalImageView imageView = (ProportionalImageView) convertView.findViewById(R.id.list_imageView); String smallImageName = "s" + c.getPhoto(); final int resourceID = resources.getIdentifier(smallImageName, "drawable", mContext.getPackageName()); imageView.setImageResource(resourceID); setHasOptionsMenu(true); return convertView; }