i have read the documentation about Fileprovider but i don't understand where i should put the images (or path of the images) that i want share. I understand that with xml file "file_path" i set the new path when my app share the images. I also understand that i must create a new file path and a new file for the image with this code:
File imagePath = new File(Context.getFilesDir(), "images");
File newFile = new File(imagePath, "default_image.jpg");
But i don't understand where i should put images in Android Studio, there is a specific directory ? And an extra question, with Fileprovider can i share a drawable resource ? Thanks
No. Moreover, given that drawables vary by density, it is unclear what this would even mean.
FileProvider
does not serve files from your app's APK or your project. It serves files from the filesystem of the user's device (e.g.,getFilesDir()
).You are welcome to package a file with your app (e.g., in
assets/
), then copy it to a location thatFileProvider
will serve from.