Created
July 2, 2013 07:43
-
-
Save ayushhgoyal/5907427 to your computer and use it in GitHub Desktop.
This is custom adapter sample file. It can be used to create different list views according to needs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SimpleCustomAdapter extends SimpleAdapter { | |
private int[] colors = new int[] { 0x30FFFFFF, 0x30ccffcc }; | |
Context context; | |
DatabaseHelper myDatabase; | |
public SimpleCustomAdapter(Context context, | |
List<HashMap<String, String>> items, int resource, String[] from, | |
int[] to) { | |
super(context, items, resource, from, to); | |
this.context = context; | |
myDatabase = new DatabaseHelper(context); | |
} | |
@Override | |
public View getView(final int position, View convertView, ViewGroup parent) { | |
View view = super.getView(position, convertView, parent); | |
// int colorPos = position % colors.length; | |
// view.setBackgroundColor(colors[colorPos]); | |
// final TextView t = (TextView) (view.findViewById(R.id.textView3)); | |
// t.setOnClickListener(new OnClickListener() { | |
// | |
return view; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment