Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:53:42+00:00 2026-06-03T05:53:42+00:00

Whenever I click the ImageView which has a OnClickListener , I get the URL

  • 0

Whenever I click the ImageView which has a OnClickListener, I get the URL of that object that is meant for the next View on the bottom of my screen, that has yet to get on the screen.

    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;
}  

And here is the code for the ViewHolder:

static class ViewHolder{
    Result thing;
    TextView title;
    TextView subreddit;
    TextView source;
    TextView score;
    ImageView image;
}

I’ve read a few things about using the setTag() method, and I’ve tried this, but I didn’t quite get what I had to put as a tag.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:53:43+00:00Added an answer on June 3, 2026 at 5:53 am

    There is no point in storing the Result data object in the ViewHolder:

    static class ViewHolder{
        TextView title;
        TextView subreddit;
        TextView source;
        TextView score;
        ImageView image;
    }
    

    The getView() method:

    //...
    else{
        holder = (ViewHolder) rowView.getTag();
    }
    Result obj = gegevens.get(position).data;
    holder.image.setTag(obj.url); // It's a String I guess?!?
    holder.image.setOnClickListener(new OnClickListener(){
    
        @Override
        public void onClick(View v) {
            String toPass = (String) v.getTag();
            Intent i = new Intent();
            i.setAction("com.tolgap.json.TEST");
            i.putExtra("page", toPass);
            context.startActivity(i);
        }
    
    });
    holder.title.setText(obj.title);
    holder.subreddit.setText(obj.subreddit);
    holder.source.setText(obj.domain);
    holder.score.setText(obj.score);
    holder.image.setImageBitmap(plaatjes.get(position)); 
    return rowView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a uiview(with two buttons) covers all the screen whenever i click on
Is there ASP button that won't submit post form data. Whenever I click an
Whenever I click in a cell, and try to rename it, I get an
Problem: I have a confirmation box which pops up whenever I click on the
I've got a simple dropdown menu that I want to hide whenever you click
I have the following code that runs whenever you click the Start button on
I want to get the text of the button whenever I click on it.
My Requirement is whenever I click on the Extension Icon that should send a
i'm trying to get the color of one button to change whenever i click
I have an activity which contains a Button,Whenever user click on button, we create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.