ContentProvider的使用

来源:互联网 发布:libevent源码下载 编辑:程序博客网 时间:2024/06/01 09:18

以下文章都是根据:

http://blog.chinaunix.net/uid-24129645-id-3758633.html

这个地址的文章进行开发和描述的。

在写这个代码的过程中,

出现了

 Caused by: java.lang.IllegalArgumentException: Unknown URL content://com.example.provider.students/student

这样的错误。

原因是students.java中

 public static final String AUTHORITY="com.example.provider";写错了。

应该是:

public static final String AUTHORITY="com.example.provider.StudentContentProvider";

要和配置文件中:

<provider            android:name=".StudentContentProvider"            android:authorities="com.example.provider.StudentContentProvider"            />


authorities写一致。

最后的运行结果是:

具体代码请到:http://download.csdn.net/detail/u012242610/6929347去下载!

 

0 0
原创粉丝点击