@Override public void bindView(View v, Context context, Cursor c) { // Lets find some info about this contact Entity entity = mDataModel.entityFromCursor(c); // Bind in contact name TextView name_text = (TextView) v.findViewById(R.id.entitylist_row_name); if (name_text != null) { name_text.setText(entity.getName()); } // Bind in contact photo ImageView entity_pic = (ImageView) v.findViewById(R.id.entitylist_row_image); if (entity_pic != null) { entity_pic.setImageDrawable(mDataModel.getPicture(entity)); } // Bind in default vibrate pattern PatternView pattern_view = (PatternView) v.findViewById(R.id.entitylist_row_pattern); if (pattern_view != null) { pattern_view.setPattern(entity.getPattern()); } }
public Entity getEntity(int position) { Cursor c = this.getCursor(); if (c == null) return null; // Save current position int pos = c.getPosition(); // Try move to given position if (!c.moveToPosition(position)) { c.move(pos); return null; } // Grab entity at position, move back and return Entity e = mDataModel.entityFromCursor(c); c.move(pos); return e; }