应用程序有同名的包路径所以安装错误
exported本身有输出的意思,配置为true允许输出
<!-- 配置内容提供者 -->
<provider
android:exported="true&quo
启动Android项目的时候,clean Project的时候,报错:
android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked Serv
这个错误的时候看得很清楚,错误报的很明显,是ExchangeService服务绑定影响的。
08-01 11:09:39.791: E/AndroidRuntime(13678): FATAL EXCEPTION: main
08-01 11:09:39.791: E/AndroidRuntime(13678): java.lang.NoClassDefFoundError: org.androidpn.client.PersistentConnectionListener
出现上述调试信息,并且真机上出现错误。
鼠标右键工程properties
去掉这个勾
package com.example.providerdata;
import android.support.v7.app.ActionBarActivity;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.Men
点击项目右键选择properties
选择Android 勾选project Build Target需要的Target
Uri uri = Uri.parse("content://com.example.AccountProvider/query");
parse就有解析的意思
content://相当于http://
com.example.AccountProvider 相当于域名
/query 相当于域名下的具体应用路径
数据库提供者项目代码:
package com.example.contextprovidertest;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
android:name="com.example.contextprovidertest.AccountProvider"
android:authorities="com