title: How can i add a sticky header to my ListView?
body: <p>I am having a listView, so i want to add a sticky header so that it sticks to the top of the listView and when a different category starts in the listView a Different header take its place, Like the contacts, where is "a" as a Sticky header is at the top till "b" comes in.
  Is there any library to do it??
  I am using custom List Adapter to show my List...</p>
  
  <p>this is my custom adapter class</p>
  
  <pre><code>public class NewsRowAdapter extends ArrayAdapter&lt;Item&gt;  {
  
  private Activity activity;
  private List&lt;Item&gt; items;
  private Item objBean;
  private int row;
  
  private DisplayImageOptions options;
  ImageLoader imageLoader;
  
  public NewsRowAdapter(Activity act, int resource, List&lt;Item&gt; arrayList) {
      super(act, resource, arrayList);
      this.activity = act;
      this.row = resource;
      this.items = arrayList;
  
  
  
      imageLoader = ImageLoader.getInstance();
      File cacheDir1 = StorageUtils.getCacheDirectory(activity);
  
      ImageLoaderConfiguration config = new
      ImageLoaderConfiguration.Builder(activity)
      .maxImageWidthForMemoryCache(600)
      .maxImageHeightForMemoryCache(400)
      .httpConnectTimeout(5000)
      .httpReadTimeout(20000)
      .threadPoolSize(3)
      .threadPriority(Thread.MIN_PRIORITY + 3)
      .denyCacheImageMultipleSizesInMemory()
      .memoryCache(new UsingFreqLimitedMemoryCache(20000)) // You can pass your own memory cache implementation
      .discCache(new TotalSizeLimitedDiscCache(cacheDir1, 30000)) // You can pass your own disc cache implementation
      .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
      .build();
  
  
      ImageLoader.getInstance().init(config);
  //              imageLoader = ImageLoader;
  //      
  
     options = new DisplayImageOptions.Builder()
      .showStubImage(R.drawable.icon2x)
      .showImageForEmptyUrl(R.drawable.icon2x).cacheInMemory()
      .cacheOnDisc().build();
  //imageLoader = ImageLoader.getInstance();
  
  }
  
  @Override
  public Item getItem(int position)
  {
      return items.get(position);
  }
  
  @Override
  public int getCount()
  {
      return items.size();
  }
  
  @Override
  public int getViewTypeCount()
  {
      return 3;
  }
  
  @Override
  public int getItemViewType(int position)
  {
      Item item = items.get(position);
      if (item.isHeader())
      {
          return TYPE_SECTION_HEADER;
      }
      else
      {
          return TYPE_LIST_ITEM;
      }
  }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      ViewHolder holder;
      if (view == null) {
          LayoutInflater inflater = (LayoutInflater) activity
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          view = inflater.inflate(row, null);
  
          holder = new ViewHolder();
          view.setTag(holder);
      } else {
          holder = (ViewHolder) view.getTag();
      }
  
      if ((items == null) || ((position + 1) &gt; items.size()))
          return view;
  
      objBean = items.get(position);
  
      holder.tvName = (TextView) view.findViewById(R.id.title);
      holder.tvId = (TextView) view.findViewById(R.id.id);
      holder.tvFlag = (TextView) view.findViewById(R.id.flag);
      holder.tvimageurl=(TextView) view.findViewById(R.id.imageurl);
      holder.tvGender = (ImageView) view.findViewById(R.id.image);
      //holder.tvAge = (TextView) view.findViewById(R.id.tvage);
      holder.pbar = (ProgressBar) view.findViewById(R.id.pbar);
      if (holder.tvName != null &amp;&amp; null != objBean.getName()
              &amp;&amp; objBean.getName().trim().length() &gt; 0) {
          holder.tvName.setText(Html.fromHtml(objBean.getName()));
      }
      if (holder.tvId != null &amp;&amp; null != objBean.getId()
              &amp;&amp; objBean.getId().trim().length() &gt; 0) {
          holder.tvId.setText(Html.fromHtml(objBean.getId()));
  
      }
      if (holder.tvFlag != null &amp;&amp; null != objBean.getFlag()
              &amp;&amp; objBean.getFlag().trim().length() &gt; 0) {
          holder.tvFlag.setText(Html.fromHtml(objBean.getFlag()));
  
      }
  
      if (holder.tvimageurl != null &amp;&amp; null != objBean.getGender()
              &amp;&amp; objBean.getFlag().trim().length() &gt; 0) {
          holder.tvimageurl.setText(Html.fromHtml(objBean.getGender()));
  
      }
  
      //if (holder.tvBDate != null &amp;&amp; null != objBean.getBirthdate()
      //      &amp;&amp; objBean.getBirthdate().trim().length() &gt; 0) {
      //  holder.tvBDate.setText(Html.fromHtml(objBean.getBirthdate()));
      //}
      if (holder.tvGender != null) {
          if (null != objBean.getGender()
                  &amp;&amp; objBean.getGender().trim().length() &gt; 0) {
              final ProgressBar pbar = holder.pbar;
  
  
              imageLoader.displayImage(objBean.getGender(), holder.tvGender,
                      options, new ImageLoadingListener() {
  
                          @Override
                          public void onLoadingComplete() {
                              pbar.setVisibility(View.INVISIBLE);
  
                          }
  
  
                          @Override
                          public void onLoadingFailed() {
                              pbar.setVisibility(View.INVISIBLE);
                          }
  
  
                          @Override
                          public void onLoadingStarted() {
                              pbar.setVisibility(View.INVISIBLE);
  
                          }
                      });
  
          } else {
              holder.tvGender.setImageResource(R.drawable.icon2x);
          }
      }
  
  
      return view;
  }
  
  public class ViewHolder {
      public TextView tvimageurl;
      public TextView tvFlag;
      public TextView tvId;
      public ProgressBar pbar;
      public TextView tvName, tvCity, tvBDate, tvAge;
      ImageView tvGender;
  }
  
  
  }
  </code></pre>
  
  <p>help needed.....</p>