Android Open Source - Books Special Cursor Adapter

From Project

Back to project page Books.


The source code is released under:

Apache License

If you think the Android project Books listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.contender.books;
/*from  w  w w.ja va  2s. co  m*/
import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleCursorAdapter;

 * Extends SimpleCursorAdapter to alternate the backgroundcolor of rows in a ListView.
 * @author unknown
public class SpecialCursorAdapter extends SimpleCursorAdapter {
  private int[] colors = new int[] { 0x99FFFFFF, 0x99dddddd };
    public SpecialCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to, int flags)  {
        super(context, layout, c, from, to, flags);
    public View getView(int position, View convertView, ViewGroup parent) {
      View view = super.getView(position, convertView, parent);
      int colorPos = position % colors.length;
      return view;

Java Source Code List