Please help, I'm newbie in android programming and sorry for my english. I'm working on android sharing file "PDF" into other apps, the process was followed from Android Sharing File but still not working, always displays an error
java.lang.IllegalArgumentException: Failed to find configured root that contains /temp.PDF
errors above happen when click the file.
DownloadListPDF.java
try {
fileUri = FileProvider.getUriForFile(DownloadListPDF.this,
"id.dutapulsa.bayartagihan.extension.FileProvider",
requestFile); //<-- in this line that shows errors
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
Manifest.xml
<activity
android:name="DownloadListPDF"
android:label="List Struk"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="application/pdf" />
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="id.dutapulsa.bayartagihan.extension.FileProvider"
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 path="pdf/" name="pdf" />
</paths>
and from logcat
06-25 09:47:18.282: W/System.err(20144): java.lang.IllegalArgumentException: Failed to find configured root that contains /temp.PDF
06-25 09:47:18.283: W/System.err(20144): at id.dutapulsa.bayartagihan.extension.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:327)
06-25 09:47:18.283: W/System.err(20144): at id.dutapulsa.bayartagihan.extension.FileProvider.getUriForFile(FileProvider.java:89)
06-25 09:47:18.283: W/System.err(20144): at id.dutapulsa.bayartagihan.DownloadListPDF$1.onItemClick(DownloadListPDF.java:56)
06-25 09:47:18.284: W/System.err(20144): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
06-25 09:47:18.284: W/System.err(20144): at android.widget.AbsListView.performItemClick(AbsListView.java:1300)
06-25 09:47:18.284: W/System.err(20144): at android.widget.AbsListView$PerformClick.run(AbsListView.java:3034)
06-25 09:47:18.284: W/System.err(20144): at android.widget.AbsListView$1.run(AbsListView.java:3834)
06-25 09:47:18.284: W/System.err(20144): at android.os.Handler.handleCallback(Handler.java:800)
06-25 09:47:18.284: W/System.err(20144): at android.os.Handler.dispatchMessage(Handler.java:100)
06-25 09:47:18.284: W/System.err(20144): at android.os.Looper.loop(Looper.java:194)
06-25 09:47:18.284: W/System.err(20144): at android.app.ActivityThread.main(ActivityThread.java:5469)
06-25 09:47:18.284: W/System.err(20144): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 09:47:18.284: W/System.err(20144): at java.lang.reflect.Method.invoke(Method.java:525)
06-25 09:47:18.284: W/System.err(20144): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:857)
06-25 09:47:18.284: W/System.err(20144): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
06-25 09:47:18.284: W/System.err(20144): at dalvik.system.NativeStart.main(Native Method)