Note that there are some explanatory texts on larger screens.

plurals
  1. POThe OnClickListener for individual views in ArrayAdapter gets mixed up
    primarykey
    data
    text
    <p>Whenever I click the <code>ImageView</code> which has a <code>OnClickListener</code>, I get the <code>URL</code> of that object that is meant for the next <code>View</code> on the bottom of my screen, that has yet to get on the screen.</p> <pre><code> public View getView(int position, View convertView, ViewGroup parent){ View rowView = convertView; if(rowView == null){ rowView = inflater.inflate(R.layout.listitem, null); //Creëer een Viewholder om alles statisch op te slaan in het geheugen holder = new ViewHolder(); holder.title = (TextView) rowView.findViewById(R.id.title); holder.subreddit = (TextView)rowView.findViewById(R.id.subreddit); holder.source = (TextView)rowView.findViewById(R.id.source); holder.score = (TextView)rowView.findViewById(R.id.score); holder.image = (ImageView)rowView.findViewById(R.id.imageView1); holder.image.setTag(position); rowView.setTag(holder); } else{ holder = (ViewHolder) rowView.getTag(); } holder.image.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent i = new Intent(); i.setAction("com.tolgap.json.TEST"); i.putExtra("page", holder.thing.url); context.startActivity(i); } }); holder.thing = gegevens.get(position).data; holder.title.setText(holder.thing.title); holder.subreddit.setText(holder.thing.subreddit); holder.source.setText(holder.thing.domain); holder.score.setText(holder.thing.score); holder.image.setImageBitmap(plaatjes.get(position)); return rowView; } </code></pre> <p>And here is the code for the <code>ViewHolder</code>:</p> <pre><code>static class ViewHolder{ Result thing; TextView title; TextView subreddit; TextView source; TextView score; ImageView image; } </code></pre> <p>I've read a few things about using the <code>setTag()</code> method, and I've tried this, but I didn't quite get what I had to put as a tag.</p>
    singulars
    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.
    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