|
|
|
|
@ -15,15 +15,15 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.model;
|
|
|
|
|
import android.content.ContentProviderOperation;
|
|
|
|
|
import android.content.ContentProviderResult;
|
|
|
|
|
import android.content.ContentUris;
|
|
|
|
|
import android.content.ContentValues;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.OperationApplicationException;
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
import android.os.RemoteException;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.content.ContentProviderOperation;//批量的更新、插入、删除数据。
|
|
|
|
|
import android.content.ContentProviderResult;//操作的结果
|
|
|
|
|
import android.content.ContentUris;//用于添加和获取Uri后面的ID
|
|
|
|
|
import android.content.ContentValues;//一种用来存储基本数据类型数据的存储机制
|
|
|
|
|
import android.content.Context;//一种用来存储基本数据类型数据的存储机制
|
|
|
|
|
import android.content.OperationApplicationException;//操作应用程序容错
|
|
|
|
|
import android.net.Uri;//表示待操作的数据
|
|
|
|
|
import android.os.RemoteException;//远程容错
|
|
|
|
|
import android.util.Log;//输出日志,比如说出错、警告等
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
|
import net.micode.notes.data.Notes.CallNote;
|
|
|
|
|
@ -51,7 +51,8 @@ public class Note {
|
|
|
|
|
values.put(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
|
values.put(NoteColumns.PARENT_ID, folderId);
|
|
|
|
|
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);
|
|
|
|
|
|
|
|
|
|
//ContentResolver()主要是实现外部应用对ContentProvider中的数据
|
|
|
|
|
//进行添加、删除、修改和查询操作
|
|
|
|
|
long noteId = 0;
|
|
|
|
|
try {
|
|
|
|
|
noteId = Long.valueOf(uri.getPathSegments().get(1));
|
|
|
|
|
|