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 8656953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:24:17+00:00 2026-06-12T15:24:17+00:00

I have a ViewHolder that has 3 textboxs, an image, and a checkbox in

  • 0

I have a ViewHolder that has 3 textboxs, an image, and a checkbox in a gridview. The problem is that I can’t seem capture/trigger onclicklistener after I added the checkbox to this viewholder.
Only the checkbox seems to set to checked or unchecked. If I click on other area that is on image or textbox I want to trigger onClick event.

Also, if someone has clue if we can setclickable to false for a few checkbox, so it can be viewed but not active to respond.

My code at the moment is in the ImageAdpater:

public View getView(int position, View convertView, ViewGroup parent)
{
    ViewHolder holder;
    ImageView imgView = null;

        if (convertView == null) {

            holder = new ViewHolder(); 
            LayoutInflater ltInflate = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); 
            convertView = ltInflate.inflate(R.layout.griditem, null);

            holder.textview1 = (TextView) convertView.findViewById(R.id.grid_item_alert_date);
            holder.textview2 = (TextView) convertView.findViewById(R.id.grid_item_alert_time);
            holder.textview3 = (TextView) convertView.findViewById(R.id.grid_item_alert_type);

            holder.imageview    = (ImageView) convertView.findViewById(R.id.grid_item_image);
            holder.checkbox = (CheckBox) convertView.findViewById(R.id.checkbox_ack);
            convertView.setTag(holder);

        }
        else
        {   
            holder = (ViewHolder) convertView.getTag();
        }

        holder.checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                 // TODO Auto-generated method stub
                  Toast.makeText(context, " checkbox checked", Toast.LENGTH_SHORT).show();

              } });

        holder.textview1.setText("Text 1 ");
        holder.textview2.setText("Text 2 ");
        holder.textview3.setText("Text 3 ");
        holder.checkbox.setChecked(false);
        holder.imageview.setImageBitmap(bitmap);
        holder.id = position;

        return convertView;

}

Code at the Activity from where imageadpater is called:

 GridView gridview = (GridView) findViewById(R.id.mygridview);
        adapter = new ImageAdapter(this);
        gridview.setAdapter(adapter);

        gridview.setOnItemClickListener(new OnItemClickListener()
        {   
            public void onItemClick(AdapterView<?> parent, View v, int position, long id)
            {
                Toast.makeText(getBaseContext(),"pic" + (position + 1) + " selected",
                        Toast.LENGTH_SHORT).show();
            }
        }
        );

So the gridview.setOnItemClickListener in the above is not being called, why?
I have tried different setups but nothing seems to work, only checkbox event works and that too if defined in getView as above.

In need of an urgent solution, Cheers

  • 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-12T15:24:18+00:00Added an answer on June 12, 2026 at 3:24 pm

    adding these lines to the checkbox in the layout xml:

    android:focusable="false"
    android:focusableInTouchMode="false"
    

    This does the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView that has one image and two lines of texts for
I have a problem with ViewHolder class. I use ViewHolder to improve my List
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have facing problem in listview i am getting data from server and after
I'm trying to display a custom ListView that has a thumbnail image and text
I have a baseAdapter class that adds data to a Gridview. Please is there
I have a problem with ListView. the thing is that when I click on
I have created a custom listview that have one webview per element. My problem
I have an Scrollview in my app that has quite a large amount of
I have a listview that contains values from webservice.Each page contains only 10 listitems

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.