private void setListAdapter(final FestivalDay d) { setListAdapter( new ArrayAdapter<ProgramSlot>( this.getActivity(), android.R.layout.simple_list_item_2, d.getSlots()) { @Override public View getView(int position, View convertView, ViewGroup parent) { View row; if (null == convertView) { row = View.inflate(getContext(), android.R.layout.simple_list_item_2, null); } else { row = convertView; } TextView tv1 = (TextView) row.findViewById(android.R.id.text1); TextView tv2 = (TextView) row.findViewById(android.R.id.text2); ProgramSlot ps = d.getSlots().get(position); tv1.setText(ps.getBand().toString()); tv2.setText(ps.getTime()); ps = null; tv1 = null; tv2 = null; return row; } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mFestivalDay = (FestivalDay) getArguments().get(KEY_PARAMS_FESTIVAL_DAY); this.getActivity() .setTitle( mFestivalDay .getDate() .getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault())); setListAdapter(mFestivalDay); return super.onCreateView(inflater, container, savedInstanceState); }