android 内容提供者给出未知 URL 内容 ://com

标签 android android-contentprovider

我正在尝试创建自定义内容提供程序,但收到一条错误消息

未知 URL 内容://com.example.test.samplecontentprovider/yay

我的 list 和内容提供者中有以下信息

  <provider
    android:authorities="com.example.test.samplecontentprovider"
    android:multiprocess="true"
    android:name="com.example.test.SampleContentProvider"></provider>

AUTHORITY = "com.example.test.samplecontentprovider" 

我哪里错了,请指教。

我在这里也包括源代码包。 http://www.fileserve.com/file/p4eNVgK

最佳答案

根据提供的来源,您在 AndroidManifest.xml 中定义您的提供者时犯了一个错误:您需要在您的应用程序标签中定义您的提供者,即

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".test"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
        <provider
        android:authorities="com.example.test.samplecontentprovider"
        android:multiprocess="true"
        android:name="com.example.test.SampleContentProvider"></provider>
</application>

关于android 内容提供者给出未知 URL 内容 ://com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6788425/

相关文章:

android - 如何跨应用程序限制内容提供者数据

android - 重用代码 Android 时的动画问题

Android:使用定义的可绘制对象以编程方式更改按钮颜色

java - 如何显示最近打开的文件列表?

android - Intent 的标志和 PendingIntent.getBroadcast

android - 无法获得提供者 - 很少在 kitkat 上崩溃

php - 如何使用 Flutter 访问 Woocommerce API?

android - 实现android content provider的查询方法,使用多个表

android - UriMatcher Uri *和#区别

android - RecyclerView.Adapter notifyDataSetChanged() 使用 ContentProvider