Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.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:ContentResolver可以在4.0上工作,但不能在2.3上工作_Android_Android Contentprovider_Android Contentresolver_Android Syncadapter - Fatal编程技术网

android:ContentResolver可以在4.0上工作,但不能在2.3上工作

android:ContentResolver可以在4.0上工作,但不能在2.3上工作,android,android-contentprovider,android-contentresolver,android-syncadapter,Android,Android Contentprovider,Android Contentresolver,Android Syncadapter,在我正在构建的联系人提供程序中,我要创建联系人组,然后将联系人添加到该组。这是我在不存在新组时创建新组的代码: if (groupId == 0) { // Sample group doesn't exist yet, so create it final ContentValues contentValues = new ContentValues(); contentValues.put(Groups.ACCOUNT_NAME, accoun

在我正在构建的联系人提供程序中,我要创建联系人组,然后将联系人添加到该组。这是我在不存在新组时创建新组的代码:

if (groupId == 0) {
        // Sample group doesn't exist yet, so create it
        final ContentValues contentValues = new ContentValues();
        contentValues.put(Groups.ACCOUNT_NAME, account.name);
        contentValues.put(Groups.ACCOUNT_TYPE, account.type);
        contentValues.put(Groups.TITLE, Constants.GROUP_NAME);
        contentValues.put(Groups.GROUP_IS_READ_ONLY, true);

        final Uri newGroupUri = resolver.insert(Groups.CONTENT_URI, contentValues);
        Log.d(TAG, newGroupUri.toString());
        groupId = ContentUris.parseId(newGroupUri);
    }
当我在安卓4.0或4.1上运行时,它可以工作,但当我在2.3
newGroupUri
上运行时,它是空的。2.3有什么问题。我在emulator和手机上都试过它

contentValues.put(Groups.GROUP\u是只读的,true);仅在api 11之后可用