Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从mulit号码中删除通话记录?_Android_String_Uri_Calllog - Fatal编程技术网

Android 从mulit号码中删除通话记录?

Android 从mulit号码中删除通话记录?,android,string,uri,calllog,Android,String,Uri,Calllog,需要从多个号码中删除呼叫日志的帮助,使用以下代码,我可以使用字符串从exatct号码中删除呼叫日志,我需要的是能够从字符串中的号码从日志中删除呼叫 下面是我用来删除精确数字的代码: String strUriCalls = "content://call_log/calls"; Uri UriCalls = Uri.parse(strUriCalls); Cursor c = context.getContentResolver().query(U

需要从多个号码中删除呼叫日志的帮助,使用以下代码,我可以使用字符串从exatct号码中删除呼叫日志,我需要的是能够从字符串中的号码从日志中删除呼叫

下面是我用来删除精确数字的代码:

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)

                {
字符串字符串字符串=”content://call_log/calls";
UriCalls=Uri.parse(strUriCalls);
游标c=context.getContentResolver().query(UriCalls,null,
空,空,空);
如果(c.getCount()=1)
{

希望这是有意义的(noob)非常感谢的任何帮助

尝试以空格为基础拆分字符串:

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)
  {
}
}
String gonnabprefd=“0750627663 09876756446 08987766545 0908977534”;
字符串[]numary=gonnabprefd.split(“”);
对于(int i=0;i=1)
{
}
}

开头带+号的数字不会被删除。

感谢您的快速回复,但是我在这部分遇到语法错误(int i=0;iohh,by mistch,it's;所以请更改为;