Skip to content Skip to sidebar Skip to footer

Sharing Files Or Content With 3rd Party Activities

I have a simple question but can't seem to find the answer anywhere I look online. I have an activity A that downloads files from the internet and puts them to a local folder obtai

Solution 1:

Is it possible to get the ACTION_VIEW activity to run within my process and user context (of activity A)?

No, nor would you want it to, for security reasons.

How do I share files between activities?

This question is the same as your next one, as far as I can tell.

Is there a way to pass the file content (not file pointer) from my activity to the Gallery activity or other activities?

The best solution is to use a ContentProvider. The simplest solution is to use FileProvider, which you can just add to your manifest and configure to serve up your files, without any need to create a subclass. See also: http://developer.android.com/training/secure-file-sharing/index.html


Solution 2:

An app can't acces the private data of another app. Being that way, "Gallery" can't reach "data/data/com.myapp.android/files". You need to put the shared files directory in the external storage.


Post a Comment for "Sharing Files Or Content With 3rd Party Activities"