Finch писал(а):Через конструктор класса.
[syntax=java5]
MyBaseAdapter adapter = new MyBaseAdapter(String[] s, boolean[] b);[/syntax]
Так и сделал
[syntax=java5]
public class BoxAdapter extends BaseAdapter {
private final Activity context;
private final String[] stationValues;
private final boolean[] favoriteValues;
public BoxAdapter(Activity context, String[] stationValues, boolean[] favoriteValues) {
this.context = context;
this.stationValues = stationValues;
this.favoriteValues = favoriteValues;
}
@Override
public int getCount() {
return 0;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int position, View view, ViewGroup group) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.item, group, false);
TextView tvStation = (TextView)rowView.findViewById(R.id.tvStation);
ImageButton ImgBtn = (ImageButton)rowView.findViewById(R.id.btnDescription);
CheckBox chkFavorite = (CheckBox)rowView.findViewById(R.id.chkFavorite);
tvStation.setText(stationValues[position]);
if (favoriteValues[position]) {
chkFavorite.setChecked(true);
}
else chkFavorite.setChecked(false);
return rowView;
}
}
[/syntax]
[syntax=java5]
BoxAdapter adapter = new BoxAdapter(getActivity(), dateStation, dateFavorite);
lvStation.setAdapter(adapter);
[/syntax]
Список не сформировался.