title: Different event by clicking on different buttons in listview by row position
body: <p>I have a listview with a custom adapter like this:
  <img src="https://i.stack.imgur.com/RF08G.png" alt="enter image description here"></p>
  
  <p>I would like to set different actions for every button in listview, for example switching by position in the listview.  How can i do that?</p>
  
  <p>This is my custom adapter:</p>
  
  <pre><code>public class Customadapter extends ArrayAdapter&lt;Formazionicontainer&gt;{
  
  Context context;
  
  public Customadapter(Context context, int resourceId,
          List&lt;Formazionicontainer&gt; items) {
      super(context, resourceId, items);
      this.context = context;
  }
  
  /*private view holder class*/
  private class ViewHolder {
      ImageView imageView;
      TextView txtTitle;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;
      Formazionicontainer rowItem = getItem(position);
  
      LayoutInflater mInflater = (LayoutInflater) context
              .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
      if (convertView == null) {
          convertView = mInflater.inflate(R.layout.list_group, null);
          holder = new ViewHolder();
          holder.txtTitle = (TextView) convertView.findViewById(R.id.text1);
          holder.imageView = (ImageView) convertView.findViewById(R.id.image1);
          convertView.setTag(holder);
      } else
          holder = (ViewHolder) convertView.getTag();
  
  
      holder.txtTitle.setText(rowItem.getTitle());
      holder.imageView.setImageResource(rowItem.getImageId());
  
      return convertView;
  }
  </code></pre>