Android contact list

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Android contact list

Postby gomathisankar » Wed Jul 07, 2010 5:55 am

Hello sir or madam,
I got contact list from default layout to listView but all contact View near How to set CheckBox??

import android.database.Cursor;
import android.provider.Contacts.People;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

* A list view example where the data comes from a cursor.
public class List7 extends ListActivity implements OnItemSelectedListener {
private static String[] PROJECTION = new String[] {
People._ID, People.NAME, People.NUMBER

protected void onCreate(Bundle savedInstanceState) {
mPhone = (TextView) findViewById(;

// Get a cursor with all people
Cursor c = getContentResolver().query(People.CONTENT_URI, PROJECTION, null, null, null);
mPhoneColumnIndex = c.getColumnIndex(People.NUMBER);

ListAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, // Use a template
// that displays a
// text view
c, // Give the cursor to the list adatper
new String[] {People.NAME}, // Map the NAME column in the
// people database to...
new int[] {}); // The "text1" view defined in
// the XML template

public void onItemSelected(AdapterView parent, View v, int position, long id) {
if (position >= 0) {
Cursor c = (Cursor) parent.getItemAtPosition(position);

public void onNothingSelected(AdapterView parent) {


private int mPhoneColumnIndex;
private TextView mPhone;
Junior Developer
Junior Developer
Posts: 13
Joined: Sat Feb 13, 2010 8:48 am


Re: Android contact list

Postby blundell » Wed Jul 07, 2010 8:27 am

wtf ... explain yourself better

and enclose your code in [code] [/ code] tags
User avatar
Master Developer
Master Developer
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests