public class ListContacts extends ListActivity {
ListAdapter lAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Cursor cursor = getContentResolver().query(
ContactsContract.Contacts.CONTENT_URI, null,
ContactsContract.Contacts.HAS_PHONE_NUMBER + " = 1", null,
"UPPER(" + ContactsContract.Contacts.DISPLAY_NAME + ") ASC");
startManagingCursor(cursor);
/** start mapping */
String[] columns = new String[] { ContactsContract.Contacts.DISPLAY_NAME };
int[] names = new int[] { R.id.contact_name };
lAdapter = new ImageCursorAdapter(this, R.layout.contact_listview,
cursor, columns, names);
setListAdapter(lAdapter);
}
public class ImageCursorAdapter extends SimpleCursorAdapter
{
public ImageCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
}
* @param pos
* : the position in the list/cursor,
* @param inView
* : The View object of the row that was last created, null if
* its the first row
* @param parent
* : The ViewGroup object of the parent view return View :
* returns a View object when called
* @see android.widget.CursorAdapter#getView(int, android.view.View,
* android.view.ViewGroup)
*/
public View getView(int pos, View inView, ViewGroup parent) {
View v = inView;
}
}