手机版
你好,游客 登录 注册
背景:
阅读新闻

Android数据共享机制ContentProvider

[日期:2012-05-08] 来源:Linux社区  作者:fwwdn [字体:大 中 小]
在描述文件中注册提供程序:AndroidManifest.xml
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"  
  3.       package="com.test.contentProvider"  
  4.       android:versionCode="1"  
  5.       android:versionName="1.0">  
  6.   
  7.     <application android:icon="@drawable/icon" android:label="@string/app_name">  
  8.         <provider android:name="NotePadProvider"  
  9.                   android:authorities="com.google.provider.NotePad"/>  
  10.         <activity android:name=".ContentProviderTest"  
  11.                   android:label="@string/app_name">  
  12.             <intent-filter>  
  13.                 <action android:name="android.intent.action.MAIN" />  
  14.                 <category android:name="android.intent.category.LAUNCHER" />  
  15.             </intent-filter>  
  16.             <intent-filter>  
  17.                 <data android:mimeType="vnd.android.cursor.dir/vnd.google.note"></data>  
  18.             </intent-filter>  
  19.             <intent-filter>  
  20.                 <data android:mimeType="vnd.android.cursor.item/vnd.google.note"></data>  
  21.             </intent-filter>  
  22.         </activity>  
  23.   
  24.     </application>  
  25. </manifest>  

运行结果如下图所示:


更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11

linux
相关资讯       Android编程入门 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款