title: Group adapter items
body: <p>i need to create a custom adapter for address book, grouping them by first name letter inside a custom layout. How can i achive a result like this?
  <img src="https://i.stack.imgur.com/hYcLm.png" alt="enter image description here"></p>
  
  <p>I created an <code>Hashmap&lt;String firstLetter,Arraylist&lt;Contacts&gt;&gt;</code> but i dunno how to pass it to an adapter to make <strong>EACH SINGLE ELEMENT OF THE LIST</strong> clickable. </p>
  
  <p>Best solution i've found up to now is to inflate as many ListView for each letter of my HashMap, and setting the adapter to it </p>
  
  <pre><code>for (Map.Entry&lt;Character, ArrayList&lt;RlyJiffyContact&gt;&gt; entry : contactLinkedHashMap.entrySet()) {
          Character key = entry.getKey();
          ArrayList&lt;RlyJiffyContact&gt; value = entry.getValue();
          if (value != null &amp;&amp; !value.isEmpty()) {
              LinearLayoutWithLabel llbel = new LinearLayoutWithLabel(getContext());
              llbel.setOrientation(LinearLayout.VERTICAL);
              llbel.setPadding(R.dimen.default_margin_left, R.dimen.default_margin_top, R.dimen.default_margin_right, R.dimen.default_margin_bottom);
              llbel.setText(key.toString().toUpperCase());
              ListView list = new ListView(getContext());
              list.setAdapter(new RlyJiffyContactsAdapter(getContext(), value));
              llbel.addView(list);
              linear.addView(llbel);
          }
  </code></pre>
  
  <p>and the adapter</p>
  
  <pre><code>public class MYADAPTER extends ArrayAdapter&lt;MYELEMENT&gt; {
  
  LayoutInflater vi;
  private Context               context;
  private List&lt;RlyJiffyContact&gt; contacts;
  public MYADAPTER(Context context, List&lt;MYELEMENT&gt; contacts) {
      super(context, 0, contacts);
      vi = LayoutInflater.from(context);
      this.context = context;
      this.contacts = contacts;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolderItem holderItem;
      View v = convertView;
      if (convertView == null) {
          holderItem = new ViewHolderItem();
  
          convertView = vi.inflate(R.layout.reply_jiffy_contact_line, null);
          holderItem.contactNumber = (TextView) convertView.findViewById(R.id.contact_number);
          holderItem.displayName = (TextView) convertView.findViewById(R.id.contact_display_name);
          holderItem.preferedImage = (ImageView) convertView.findViewById(R.id.icon_prefered);
          convertView.setTag(holderItem);
      } else {
          holderItem = (ViewHolderItem) convertView.getTag();
      }
      RlyJiffyContact item = getItem(position);
      holderItem.contactNumber.setText(item.getPhoneNumber());
      holderItem.displayName.setText(item.getName() + " " + item.getSurname());
      if (item.isPrefered()) {
          holderItem.preferedImage.setVisibility(View.INVISIBLE);
      } else {
          holderItem.preferedImage.setVisibility(View.VISIBLE);
      }
      convertView.setOnClickListener(new ContactPhoneListener(item.getPhoneNumber()));
      return convertView;
  }
  static class ViewHolderItem {
      TextView  contactNumber;
      TextView  displayName;
      ImageView preferedImage;
  
  }
  private class ContactPhoneListener implements View.OnClickListener {
      private String number;
      public ContactPhoneListener(String number) {
          this.number = number;
      }
      @Override
      public void onClick(View v) {
          Intent i = new Intent(getContext(), FIRSTACTIVITY.class);
          i.putExtra(Constants.CONTACT_IDENTIFIER, number);
          i.setAction(Constants.SENDING_CONTACT);
          context.startActivity(i);
      }
  }
  </code></pre>
  
  <p>But the result is that i can see only first element for each letter(
  EXAMPLE:</p>
  
  <p>my contacts:</p>
  
  <ul>
  <li>Anne a</li>
  <li>Anne B</li>
  <li><p>anthony c </p></li>
  <li><p>Bob a </p></li>
  <li>Bob b</li>
  <li>Bob c</li>
  </ul>
  
  <p>what i see in my list</p>
  
  <ol>
  <li>Anne a</li>
  <li>Bob a</li>
  </ol>
  
  <p>thanks!</p>