Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - delete contact details

delete contact details

Put your problem here if it does not fit any of the other categories.

delete contact details

Postby saif_zeenwala » Tue Nov 03, 2009 12:01 pm

hi guys

I am newbie to android

Actually i want to delete contacts details from phone

I want to delete all information pertaining to contact list
like name, phone number, emailID, photo, multiple numbers if have etc

I had written some code but able to delete only numbers, not other details

I am pasting here my code
Please let me know where i am wrong


// An array specifying which columns to return.
String[] projection = new String[] {
People._ID,
People.NAME,
People.NUMBER,
};

// Get the base URI for People table in Contacts content provider.
// which is: content://contacts/people/
Uri contactUri = People.CONTENT_URI;

// Best way to retrieve a query; returns a managed query.
Cursor peopleCursor = managedQuery (contactUri,
projection, //Which columns to return.
null, // WHERE clause--we won't specify.
null, // Selection Args??
People.DEFAULT_SORT_ORDER); // Order-by name

// go to the beginning of the list
peopleCursor.moveToFirst();


ArrayList<String> idsToDelete = new ArrayList<String>();
if(peopleCursor.moveToFirst()) {
final int colId = peopleCursor.getColumnIndex(People.Phones._ID);
final int colNumber = peopleCursor.getColumnIndex(People.Phones.NUMBER);
final int colName = peopleCursor.getColumnIndex(People.Phones.NAME);
do {
String id = peopleCursor.getString(colId);
String number = peopleCursor.getString(colNumber);
String name = peopleCursor.getString(colName);
Log.i("DEBUG","id::::"+ id + ":::::"+ number+ ":::::::"+ name);
idsToDelete.add(id);
} while (peopleCursor.moveToNext());

Log.i("DEBUG","after while loop.........");
Uri.Builder builder = contactUri.buildUpon();
Uri phoneNumbersUri = builder.build();

Log.i("DEBUG","AFTER some Lines.....");

for (String id : idsToDelete) {
Log.i("DEBUG","id:::::::"+ id);
builder.encodedPath(People.Phones.CONTENT_DIRECTORY + "/" + id);
phoneNumbersUri = builder.build();
getContentResolver().delete(phoneNumbersUri, "1 = 1", null);
}
}

Plz suggest.
saif_zeenwala
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Nov 02, 2009 7:40 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 10 guests