0
<provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="${applicationId}.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths"/>
    </provider>

filepaths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path
    name="my_images"
    path="files/images" />
<external-path
    name="my_images"
    path="files/images" />
<external-files-path
    name="myexternalimages"
    path="files/images" />
<external-cache-path
    name="name"
    path="files/images" />
<cache-path
    name="name"
    path="files/images" />
</paths>

I've added all possible paths.

Code :

if (file != null)
  if (file.exists()) {
            String str = context.getPackageName() + ".fileprovider";
            Uri uri =  FileProvider.getUriForFile(context, str, file);
            return uri;
        }

Created file path is like this

/data/user/0/com.sample1.sample2/files/images/UReview9.jpg

I'm trying to call TwitterShare where i need to put file uri. Could anyonetell me what could be the problem ?

TIA

Shahal
  • 1,008
  • 1
  • 11
  • 29

0 Answers0