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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:06:39+00:00 2026-05-24T07:06:39+00:00

I have a listview and custom layout consisting of TextView, ImageView, ImageButton. I want

  • 0

I have a listview and custom layout consisting of TextView, ImageView, ImageButton. I want my image button to behave like RadioButton. But my onListItemClick event is not getting invoked.

public class MyListAdapter extends BaseAdapter {

    Context context;
    ArrayList<String> text;
    ArrayList<String> Count;

    int count;

    public MyListAdapter(Context ctx, ArrayList<String> text, ArrayList<String> Count) {
        this.context = ctx;
        this.textAnswers = text;
        this.optionCount = Count;
    }

    @Override
    public int getCount() {
        return Count.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if(convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.custom_layout, null);
        }

        ImageButton choice = (ImageButton)convertView.findViewById(R.id.ImageButton);
        if(imageChoice != null) {
            choice.setImageResource(R.drawable.radio_unselected);

        }

        TextView txt = (TextView)convertView.findViewById(R.id.TextView);
        txt.setText(Count.get(position));

        TextView txtText = (TextView)convertView.findViewById(R.id.TextViewAnswer);
        txtText.setText(textAnswers.get(position));

        return convertView;
    }
}

And my onListItemClick as,

@Override
protected void onListItemClick(ListView listView, View v, int position, long id) {
    super.onListItemClick(listView, v, position, id);
    ImageButton choice = (ImageButton)v.findViewById(R.id.ImageButton);
    choice.setImageResource(R.drawable.radio_selected); 
}

Now plz any one help to give my imagebutton the behavior like radiobutton. Most important i missed is that my onListItemClick is not getting invoked.
Also I have set the android:focusable=”false” android:focusableInTouchMode=”false” android:clickable=”false” of all controls on my custom_layout.
Thanks in advance.

  • 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-24T07:06:40+00:00Added an answer on May 24, 2026 at 7:06 am

    You need to add a setOnItemClickListener to your ListView in the main activity, if you do not, you’ll never get a call to the itemClick.

    for instance:

    OnCreate() Method:

    ListView lv = (ListView) findViewById(R.id.listview1);
    
    lv.setOnItemClickListener(this);
    

    // Create the method below and let the activity implement onitemclicklistener

    public void onItemClick(AdapterView<?> a, View v, int position, long id) {
    //set action here
     }
    

    that should work 🙂

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

Sidebar

Related Questions

I have a custom listview which display an image, textview and radio button. I
I have a listView with custom objects defined by the xml-layout below. I want
I have created a custom tab layout which look like this,I want to make
I want to create a layout which contains TextView , Button and ListView here
I have a listview with custom rows. In imageView1 I set an image, but
I have a listview with custom row having a textview and a clickable image
I have a Custom ListView created from XML Layout. I want to bind that
I have a custom listView with a textView, editText and a Button on a
I have following situation: I have a custom ListView with ImageView and TextView in
I have a ListView with some custom layout for the row (an image, then

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.