1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
public class MonAdapter extends ArrayAdapter<MaClasse>{
public MonAdapter(Context context) {
super(context, R.layout.listrow);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.listrow, null);
}
MaClasse o = getItem(position);
if (o != null) {
TextView tt = (TextView) v.findViewById(R.id.libelle);
if (tt != null) {
tt.setText(o.getArret().getLibelle());
}
LinearLayout layout = (LinearLayout) v
.findViewById(R.id.mylot2);
LinearLayout layout3 = (LinearLayout) v
.findViewById(R.id.mylot3);
int count=0;
image = new ImageView(getContext());
int resid = getContext().getResources().getIdentifier("ligne_"+o.getLigne().numLigne.toLowerCase(), "drawable","fr.monpackage");
image.setImageResource(resid);
layout.addView(image,new LinearLayout.LayoutParams(50, 50));
}
return v;
}
} |
Partager