Skip to content

Instantly share code, notes, and snippets.

@ayushhgoyal
Created July 2, 2013 07:43
Show Gist options
  • Save ayushhgoyal/5907427 to your computer and use it in GitHub Desktop.
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.
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