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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:31:02+00:00 2026-06-01T13:31:02+00:00

I am trying to create a ListView with CheckBox’s…Th ListView should allow the user

  • 0

I am trying to create a ListView with CheckBox’s…Th ListView should allow the user to both select an item or open that item to select other choice inside it. In other words, the ListView should be able to distinguish between the click on the checkbox and the click on the item itself.

I tried to implement it using android.R.layout.simple_list_item_multiple_choice but this one allows me to only check the checkbox even if I click outside the checkbox (on the item).

anyone can help?
Here’s my code,

import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class ListViewActivity extends Activity implements OnItemClickListener {  

ListView directoryList;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final ArrayList<String> contacts = new ArrayList<String>();
    contacts.add("zaid");
    contacts.add("hazem");
    contacts.add("Oubai");


    directoryList= (ListView) findViewById(R.id.directoryList);


    final ArrayAdapter<String> arrayAdapter;
    arrayAdapter = new ArrayAdapter<String>(this,
                                  android.R.layout.simple_list_item_multiple_choice,
                                  contacts);


    directoryList.setAdapter(arrayAdapter);
    directoryList.setOnItemClickListener(this);
    directoryList.setClickable(true);



}

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {




}

}

  • 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-01T13:31:03+00:00Added an answer on June 1, 2026 at 1:31 pm

    You need a customized array adapter. In your getView(), get a hold of your checkbox and set the OnCheckedChangeListener()

    Here is a tutorial on how you can make your own custom adapter. The example has a clickable textbox but you can change it to work for a checkbox.

    http://www.shubhayu.com/android/listview-with-arrayadapter-and-customized-items

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

Sidebar

Related Questions

I'm trying to create a layout for a ListView, with a checkbox to the
I am trying to create a custom ListView using an ArrayAdapter . POJO Item
I'm trying to create a ListView with items that have two lines of text,
I'm trying to create an AlertDialog that opens when an item is click in
I'm trying to create a check/uncheck all CheckBox for a number of CheckBoxes that
I'm trying to create a user control template that I can send as email.
I'm trying to create a listview where upon tapping an item the background changes
I'm trying to create a custom view (one that is not 100% listview, for
I'm trying to create a UserControl that contains a ListView and a number of
So I'm trying to create a screen which has a ListView and over that

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.