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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if(convertView==null)
{
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.adapter_list_sound, null);
// textview
holder.tv_nom_sound = (TextView) convertView.findViewById(R.id.tv_name_record);
holder.tv_duree_sound = (TextView) convertView.findViewById(R.id.tv_duration_sound);
holder.tv_heure_sound = (TextView) convertView.findViewById(R.id.tv_heures_sound);
holder.tv_poid_sound = (TextView) convertView.findViewById(R.id.tv_poids_sound);
// image view
holder.img_pause_play = (ImageView) convertView.findViewById(R.id.img_pause_play);
// linear layout
holder.linearLayout_ligne = (LinearLayout) convertView.findViewById(R.id.LinearLayout_ligne);
holder.linearLayout_ligne.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
holder.img_pause_play.setVisibility(View.VISIBLE);
}
});
holder.img_pause_play.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
holder.img_pause_play.setVisibility(View.INVISIBLE);
//ListSoundRecord.mp.pause();
}
});
convertView.setTag(holder);
}
else{
holder=(ViewHolder)convertView.getTag();
}
Log.e("VALEUR DE POSITION : ", String.valueOf(position));
holder.linearLayout_ligne.setTag(position);
holder.tv_position_list_view.setText(String.valueOf(position));
holder.tv_nom_sound.setText(((Sound) itemList.get(position)).getNom());
holder.tv_duree_sound.setText(((Sound) itemList.get(position)).getDuree());
holder.tv_heure_sound.setText(((Sound) itemList.get(position)).getHeure());
holder.tv_poid_sound.setText(((Sound) itemList.get(position)).getPoids());
return convertView;
} |