Need help with deleting call log from multi numbers, using the following code i can delete calls logs from an exatct number using a string, what i need is to be able to delete calls from the log from numbers in the string.
heres the code im using for deleting exact numbers:
String strUriCalls = "content://call_log/calls";
Uri UriCalls = Uri.parse(strUriCalls);
Cursor c = context.getContentResolver().query(UriCalls, null,
null, null, null);
if (c.getCount() <= 0)
{
Toast.makeText(context, "Call log empty",
Toast.LENGTH_SHORT).show();
}
while (c.moveToNext())
{
//eg.what I need is: String gonnabpref = "0750627663 09876756446 08987766545 0908977534";
String gonnabpref = "0750627663";
String queryString = "NUMBER='" + gonnabpref + "'";
Log.v("Number ", queryString);
int i = context.getContentResolver().delete(UriCalls,
queryString, null);
if (i >= 1)
{
Hope this makes sense (noob) any help much appreciated
try this way by split string on the basis of space:
String gonnabprefd = "0750627663 09876756446 08987766545 0908977534";
String[] numarry=gonnabprefd.split(" ");
for(int i=0;i<numarry.length;i++)
{
String gonnabpref = numarry[i];
String queryString = "NUMBER='" + gonnabpref + "'";
Log.v("Number ", queryString);
int i = context.getContentResolver().delete(UriCalls,
queryString, null);
if (i >= 1)
{
}
}