之前,所以我不知道该怎么做或什么意思我从来没有得到这个错误未处理的异常类型的错误
未处理的异常类型
OperationApplicationException
它发生在这个代码:
public void putSettings(SharedPreferences pref){
ArrayList<ContentProviderOperation> ops =
new ArrayList<ContentProviderOperation>();
ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
.withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
.withValue(Data.MIMETYPE,"vnd.android.cursor.item/color")
.withValue("data1",nColor).build());
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); //error
ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
.withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
.withValue(Data.MIMETYPE,"vnd.android.cursor.item/vibrate")
.withValue("data1", nVibrate).build());
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); //error
ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
.withSelection(Data.RAW_CONTACT_ID + "=?", new String[]{String.valueOf(pref.getString(SmsPrefs.ID, ""))})
.withValue(Data.MIMETYPE, "vnd.android.cursor.item/sound")
.withValue("data1", ringTonePath).build());
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);//error
}
它给了我两个选择“添加抛出声明”和“使用的try/catch包围”。
我有什么做的,为什么呢?
这是抛出什么?您违反了联系操作的限制。 – Reno 2011-03-02 02:49:03