短线的内容提供者的访问地址:content://sms/
Mainfest.xml 中:
<instrumentation
android:name="android.test.InstrumentationTestRunner"android:targetPackage="com.xh.tx.contentresolver"
></instrumentation>
<uses-permission android:name="aaa.bbb.ccc"/>
<uses-permission android:name="aaa.bbb.ccc.ddd"/>
{
//访问地址:content://com.xh.tx.contentprivoder.PersonContentPrivoder/person/insert
ContentResolver resolver = getContext().getContentResolver(); //内容提供者的访问类
ContentValues values = new ContentValues();
values.put("name", "sz");
values.put("age", "20");
resolver.insert(Uri.parse("content://com.xh.tx.contentprivoder.PersonContentPrivoder/person/insert"), values);
本文介绍Android中ContentProvider的基本用法,包括通过ContentResolver进行数据插入操作的具体实现过程。示例展示了如何构建ContentValues对象并使用Uri指定具体的内容提供者及路径。
5875

被折叠的 条评论
为什么被折叠?



