Reading pdf stored in internal memory (file path is not valid)

I want to open the PDF stored in the mobile internal memory ... I try to transfer the file path to Uri .. but it continues to show me this error "File path is not valid" but I am sure that I am doing the right path.

    targetFile=new File("/data/data/package Name/app_mydir/test.pdf");

            }

        Intent intent;
        intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(targetFile), "application/pdf");


               startActivity(intent);
+5
source share
2 answers

Files in the internal storage directory of your application are private by default for your application. This means that the PDF-Reader application cannot read this file (since it does not work with your pid applications - read permission is not specified).

PDF Context.MODE_WORLD_READABLE. , .

Context.openFileOutput() Context.openFileInput() ( ). , .

+8

targetFile.exists();

true, , - .

0

All Articles