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

  • Home
  • SEARCH
  • 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 6100581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:24:11+00:00 2026-05-23T13:24:11+00:00

I have implemented an adapter for my ListView which extends BaseAdapter. My list items

  • 0

I have implemented an adapter for my ListView which extends BaseAdapter.
My list items contain buttons that each of them have OnClickListener.

after adding OnclickLister for each item, the list’s OnItemClickListener stoped working.

How can it be fixed?

the code

In my Activity –

        ListView lv = (ListView) findViewById(R.id.list);
    lv.setTextFilterEnabled(true);  
    lv.setItemsCanFocus(true); 
    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String debString = "position = " + position + " id = " + id;                
            Log.d(TAG, debString);
            Toast.makeText(getApplicationContext(), debString, Toast.LENGTH_SHORT).show();
            Contact selectedContact = dataVector.elementAt(position);
            Bundle bundle = new Bundle();
            bundle.putInt(Constants.POSITION, position);
            bundle.putString(Constants.NAME, selectedContact.getName());
            bundle.putString(Constants.MDN, selectedContact.getMdn());
            bundle.putString(Constants.STATUS, selectedContact.getStatus());
            String filePath = null;
            if(contactsImagesProperties != null || !Utils.isNullOrEmpty((String) contactsImagesProperties.get(selectedContact.getMdn()))) {
                filePath = (String) contactsImagesProperties.get(selectedContact.getMdn());
            }
            bundle.putString(Constants.IMAGE, filePath);
            Intent intent = new Intent(context, ChildDisplayActivity.class);
            intent.putExtras(bundle);
            getParent().startActivityForResult(intent, 10);
        }           

in myBaseAdapter in getView()

        bitmap = Bitmap.createScaledBitmap(bitmap, Constants.CHILD_ICON_WIDTH, Constants.CHILD_ICON_HEIGHT, false);
    imageView.setImageBitmap(bitmap);
    statusView.setText(Constants.StatusCodeHandler.getStatusDesc(dataVector.elementAt(position).getStatus(), context));
    ImageButton imageButton = (ImageButton) view.findViewById(viewIds[3]);
    imageButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Bundle bundle = new Bundle();
            bundle.putInt(Constants.ACTION, Constants.CONTACT_LOCATION_CODE);
            bundle.putString(Constants.MDN, dataVector.elementAt(position).getMdn());
            MainActivity.bundle = bundle;
            TabActivity mainActivity = (TabActivity) ((UsersListActivity)context).getParent().getParent();
            TabHost tabHost = mainActivity.getTabHost();
            tabHost.setCurrentTab(Constants.MAP_TAB_INDEX);
        }
    });

in myListRaw.xml –

<ImageView android:src="@drawable/icon" 
    android:id="@+id/childListImageView" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:focusable="false"
    android:clickable="false"
    android:focusableInTouchMode="false"
    android:layout_alignParentRight="true"/>

<TextView android:id="@+id/childListTextView" 
    android:layout_marginRight="5dp" 
    android:layout_width="wrap_content" 
    android:text="TextView" 
    android:layout_height="wrap_content" 
    android:focusable="false"
    android:clickable="false"
    android:focusableInTouchMode="false"
    android:layout_toLeftOf="@+id/childListImageView" 
    android:layout_centerVertical="true"/>

<TextView android:layout_height="wrap_content" 
    android:layout_marginLeft="5dp"
    android:text="Child Status" 
    android:id="@+id/childListStatus" 
    android:layout_width="wrap_content"         
    android:layout_toLeftOf="@+id/childListTextView" 
    android:layout_marginRight="15dp"
    android:focusable="false"
    android:clickable="false"
    android:focusableInTouchMode="false"
    android:layout_centerVertical="true"/>

<ImageButton android:id="@+id/childListButton" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Loc"  
    android:layout_marginTop="5dp"      
    android:layout_alignParentLeft="true"
    android:focusable="false" 
    android:clickable="false"
    android:focusableInTouchMode="false"/>

  • 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-23T13:24:12+00:00Added an answer on May 23, 2026 at 1:24 pm

    If you set your parts of row as focusable (android:focusable=”true”) than OnItemClickListener for ListView doen not respond. Check it out

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

Sidebar

Related Questions

I have implemented a python webserver. Each http request spawns a new thread. I
I have implemented a linked list as a self-referencing database table: CREATE TABLE LinkedList(
I have a class A which extends Activity. From the class A ,I am
I have a ListView whose rows are formatted by me. Each row has a
i have a listview and implemented onclick and also onfling.problem is when i do
I have implemented what I thought was a pretty decent representation of MVC in
I have implemented a simple file upload-download mechanism. When a user clicks a file
I have implemented a SAX parser in Java by extending the default handler. The
I have implemented VirtualPathProvider class so I can keep all my views in the
I have implemented tracing based on System.Diagnostics. I am also using a System.Diagnostics.TextWriterTraceListener, and

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.