Android ListView with CheckBox can distinguish the click
<p>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. </p>

<p>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).</p>

<p>anyone can help?<br>
Here's my code,</p>

<pre><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&lt;String&gt; contacts = new ArrayList&lt;String&gt;();
    contacts.add("zaid");
    contacts.add("hazem");
    contacts.add("Oubai");


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


    final ArrayAdapter&lt;String&gt; arrayAdapter;
    arrayAdapter = new ArrayAdapter&lt;String&gt;(this,
                                  android.R.layout.simple_list_item_multiple_choice,
                                  contacts);


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



}

@Override
public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {




}
</code></pre>

<p>}</p>
