Doctor Watson
Doctor Watson

Reputation: 71

Sharing and saving pictures from app

I'm still working on my image gallery app. My new problem is the FileProvider. I have pictures in a subdirectory of the asset folder and I want to save a picture on the device - and sharing it to another app - when the relative button is clicked. In the developer guide, I found the use of the FileProvider which still doesn't work for me. The method getFilesDir() gives the error "Non-static method cannot be referenced from a static context". I don't know how to solve this and not even if this is really what I need to do. If anyone has another idea to save/share my picture I would be grateful :)enter image description here

(I followed exactly every step from the guide until this)

Upvotes: 0

Views: 149

Answers (2)

Kunal Puri
Kunal Puri

Reputation: 185

Use MediaStore to access gallery images.

https://developer.android.com/reference/android/provider/MediaStore.Images.Media.html

Upvotes: 0

user5371335
user5371335

Reputation:

getFilesDir() should be called with a reference to a context. You are using 'Context' class name simply.

Suppose if your Activity name is 'SampleActivity', try

SampleActivity.this.getFilesDir()

Upvotes: 1

Related Questions