Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it's the beginning of the issue! </p> <p>I use it and it works </p> <pre><code>public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { //Largeur des colonnes LargeurCol = (int) ((largeurEcran / 4)-7); System.out.println(LargeurCol); mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return count; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.galleryitem, null); holder.imageview = (ImageView) convertView.findViewById(R.id.thumbImage); holder.imageview.setLayoutParams(new RelativeLayout.LayoutParams(LargeurCol, LargeurCol)); holder.checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox); holder.checkbox.setButtonDrawable(R.drawable.checkbox); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.checkbox.setId(position); holder.imageview.setId(position); holder.checkbox.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub CheckBox cb = (CheckBox) v; int id = cb.getId(); if (thumbnailsselection[id]){ cb.setChecked(false); thumbnailsselection[id] = false; } else { cb.setChecked(true); thumbnailsselection[id] = true; } } }); holder.imageview.setOnClickListener(new OnClickListener() { public void onClick(View v) { int id = v.getId(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + arrPath[id]), "image/*"); startActivity(intent); } }); holder.imageview.setImageBitmap(thumbnails[position]); holder.checkbox.setChecked(thumbnailsselection[position]); holder.id = position; return convertView; } } class ViewHolder { ImageView imageview; CheckBox checkbox; int id; } </code></pre> <p>The setLayoutParams is not an obligation it's to adapt the row size to the screen.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload