title: Android, click on checkbox in my list doesn't affect onListItemClick() method?
body: <p>In my application, I have a list. This list includes some texts and a checkbox. In Xml definition of list, If I put <code>android:focusable="true"</code> then I can click it and change it's status from checked to not checked and vice versa. But I can't change its status when I click on its row.</p>
  
  <p>If I put <code>android:focusable="false"</code> the story will exchange. If I choose row, I can change the status of checkbox while if I click on it, nothing will change. <strong>I need regardless of clicking on row or checkbox, status of chackbox changes.</strong> If i click on checkbox it's status will change but my list doesn't aware of this changes therefore, onListItemClick() not execute.</p>
  
  <p>I tried to add another element <code>android:enabled="false"</code>. But UI is not user friendly. Also, when I click on checkbox its status is not changed.</p>
  
  <p>What is your suggestion? </p>
  
  <p>This is xml code of list:</p>
  
  <pre><code>    &lt;LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical" &gt;
  
          &lt;RelativeLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="?android:attr/listPreferredItemHeight"
              android:padding="6dip" &gt;
  
              &lt;CheckBox 
                  android:id="@+id/checkbox"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentTop="true"
                  android:layout_alignParentBottom="true"
                  android:layout_marginRight="6dip"
                  android:layout_marginLeft="4px"
                  android:focusable="false" /&gt;
  
  .
  .
  .
  </code></pre>
  
  <p>and in code: Flag and planId are String Array.</p>
  
  <pre><code>private String[] flag = new String[50];
  private String[] planId = new String[50];
  
  @Override
      public void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
          Log.i("List Clicked:", "******");
  
          //Toggle CheckBox from not selected to selected and vice versa.
          if(flag[position] == "true")
              flag[position] = "false";
          else
              flag[position] = "true";
  
          //Keep this CheckBox selected and clear the rest.
          for(int i=0; i&lt;position; i++)
              flag[i] = "false";
          for(int i=position+1; i&lt;flag.length; i++)
              flag[i] = "false";
  
          //If checkBox is selected show dialog if cleared don't show
          if(flag[position] == "true")
              //alertDialog.show();
              dialog.show();
  
          //Extracting Plan Id
          subscriptionPlanId = planId[position];
      }
  </code></pre>
  
  <p>screen capture:</p>
  
  <p><img src="https://i.stack.imgur.com/FUThT.png" alt="enter image description here"></p>
  
  <p>=======>
  <strong>Update</strong>:</p>
  
  <pre><code>//*********************
      //  RowModel Class
      //*********************
      private class RowModel{
          TextView title;
          TextView description;
          CheckBox checkbox;
      }
  
      //*********************
      //  ListAdapter Class
      //*********************
      private class ListAdapter extends ArrayAdapter&lt;String&gt;{
  
          public ListAdapter(Context c) {
              super(c, R.layout.infindo_listformat, list);
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              RowModel holder;
              View row = convertView;
  
              if(row == null){
                  LayoutInflater inflater = getLayoutInflater();
                  row = inflater.inflate(R.layout.infindo_listformat, parent, false);
  
                  holder = new RowModel();
                  holder.title = (TextView) row.findViewById(R.id.title);
                  holder.description = (TextView) row.findViewById(R.id.description); 
                  holder.checkbox = (CheckBox) row.findViewById(R.id.checkbox);
  
                  row.setTag(holder);
  
              } else {
                  holder = (RowModel) row.getTag(); 
              }
  
              holder.title.setText(titels[position]);
              holder.description.setText(descriptions[position]);
              String s = flag[position];
              if(s.equalsIgnoreCase("false"))
                  holder.checkbox.setChecked(false);
              else
                  holder.checkbox.setChecked(true);
  
              return(row);
          }
      }
  </code></pre>