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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:34:39+00:00 2026-05-27T05:34:39+00:00

I have a list view with an image view and text in a linear

  • 0

I have a list view with an image view and text in a linear layout. I want to perform different operations when user clicks on the Image view and the Text view. I have tried onItemClickListener but it’s capturing on the whole linear layout. I tried onClickListener in custom adapter, but were unable to get its position.

How can I resolve this problem?

  • 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-05-27T05:34:40+00:00Added an answer on May 27, 2026 at 5:34 am

    Here i m sharing my code.i have three Textviews in each list item and on one of them i put a listener.This code is for reference.Learning from the below code U can put listeners on different list items.Now i hope u can write code as u want.

    static class ViewHolder {
        public TextView tv1,tv2,tv3;
    
            }
    
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
    
        View rowView = null;
        final ViewHolder holder = new ViewHolder();
        if (convertView == null) {
    
            LayoutInflater inflator = context.getLayoutInflater();
            rowView = inflator.inflate(R.layout.attach_pic, null);
    
            holder.tv1 = (TextView) rowView.findViewById(R.id.defectpic);
            holder.tv2 = (TextView) rowView.findViewById(R.id.no_of_uploded_pics);
            holder.tv3 = (TextView) rowView.findViewById(R.id.camera);
    
            holder.tv3.setOnClickListener(new View.OnClickListener() {
    
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub  
    
                    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                    cameraIntent.putExtra(TAG, position);
                    context.startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
    
                }
            });
    
            rowView.setTag(holder);
            List itemVal1 = (List)getItem(position);
            String st1 = (String)itemVal1.get(0);
            holder.tv1.setText(st1);
    
            List itemVal2 = (List)getItem(position);
            String st2 = (String)itemVal2.get(1);
            holder.tv2.setText(st2);
    
        } else {
            rowView = convertView;
            ((ViewHolder) rowView.getTag()).tv1.setTag(list.get(position));
            ((ViewHolder) rowView.getTag()).tv2.setTag(list.get(position));
            ((ViewHolder) rowView.getTag()).tv3.setTag(list.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 have a custom list view with image view and text view.I am loading
I currently have a simple list view adapter that holds two rows of text.
in my app i have a list view. Each list consists of a image,
I have a little issue with setting an image to a list view using
I have a list view with custom adapter, with an Image Button and a
I have a list adapter that handles objects with some image and text and
I have a simple layout file which displays the icons and some text view
I have a list view of a thumbnail and text next to each other.
I have a list of 70 text items with image icons(which are stored in
I have some problems in implementing a list view with 3 items, one text,

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.