开发者

Share files between applications

Can i share one application related data wi开发者_运维技巧th another. Say I have a music file in resources/raw folder of apk2. Can I use the same file in apk1.

thx...


If your apps are signed with the same certificate and have the same android:sharedUserId declared in the manifest, they can share data in that they can read/write to each others' data directories. They can even share a process if you'd like them to (see android:process).


The application which has the music file will need to implement a Content Provider. This will allow the other application to retrieve the content.


To share the files between the apks, you need to pass the uri of the files along with the implementation of Content Provider. And while accessing it back, use the content resolver in the second apk.

You can see this in Gallery and Email app integration where an image gets attached to the email from Gallery.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜