我想打開一個pdf存儲在移動內部存儲器... 我想通過文件路徑的Uri ..但它保留我看這個錯誤 「文件路徑無效」 但我敢肯定,我把正確的道路..閱讀pdf存儲在內部存儲器(文件路徑是無效的)
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);
你的文件如何保存?一般來說,數據文件最終在您的應用程序目錄中名爲「文件」的文件夾內,而不是根目錄。 – FoamyGuy 2011-12-16 19:54:30
我使用這個 directory = getBaseContext()。getDir(「mydir」,Context.MODE_PRIVATE); \t \t \t} \t \t File file1 = new File(directory,PdfName); – Reham 2011-12-16 20:02:56