title: How can I click each item individually when using BaseAdapter in ListView?
body: <p>I have a problem with clicking on the item in a custom <code>ListView</code> which contains <code>ToggleButton</code>, <code>Button</code>, <code>TextView</code> and <code>Spinner</code> in each row. The question: How can I do that when I click each view individually, different action is called for each view? My code: </p>
  
  <pre><code>public class CustomListAdapter extends BaseAdapter {
  
               Context _context;
               private ArrayList&lt;String&gt; _list;  
  
               public CustomListAdapter(Context context, 
                                           ArrayList&lt;String&gt; listItems) {
                _context= context;
                _list = listItems; 
               }
  
               public int getCount(){
                return _list.size();
               }
  
               public long getItemId(int position){
                return position;
               }
  
               public Object getItem(int position){
                return _list.get(position);
               } 
  
  
  
               public View getView(int position,View convertView,ViewGroup parent)
               {
                 ViewContainer container = new ViewContainer();       
  
                 if(convertView == null)
                 {  
                     LayoutInflater inflater = LayoutInflater.from(_context);
                     convertView = inflater.inflate(R.layout.elements,parent, false);
                     convertView.setTag(container); 
                     convertView.setClickable(true);
  
                     container.listIcon = (ToggleButton)convertView.findViewById(R.id.togle_item);
                     container.listText = (TextView)convertView.findViewById(R.id.text_listitem);
                     container.spinner=(Spinner)convertView.findViewById(R.id.spinner1);
                     container.but=(Button)convertView.findViewById(R.id.button1);
                    convertView.setOnClickListener(new OnClickListener() {
  
                         public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) 
                         {
  
                           **How can I do that when I click each view individually, different action is called for each view???**
                         }
  
                      public void onClick(View v) {
  
                      }
  
                      }
                    );
                 }
                   container = (ViewContainer) convertView.getTag();
                   ToggleButton myListIcon = container.listIcon;
                   myListIcon.setChecked(true);
                   Button MyButton=container.but;
                   TextView myListText = container.listText;
                   myListText.setText(_list.get(position));
                   Spinner MySpinner=container.spinner;
                   MySpinner.setAdapter(adapter);
                   container = null;
                   return convertView;
                }
                private class ViewContainer
                {
                    private ToggleButton listIcon; 
                    private TextView listText;
                    private Spinner spinner;
                    private Button but;
                }
  
          }
  </code></pre>