0
我可以從我的資產文件夾獲取文件中像這樣打開從資產文件夾中的PDF文件
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse("file:///android_asset/help_doc.pdf"), "application/pdf");
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(i);
}catch(ActivityNotFoundException e){
Toast.makeText(this, "No Application Available to View PDF", Toast.LENGTH_SHORT).show();
}
但是當我選擇的應用程序打開它,它要麼不開,也不給我一個錯誤說error opening file. it does not exist or cannot be read
但如果我把它放在我的SD卡上,並點擊它來打開它,我不會得到這個錯誤,所以我怎麼做錯了?
當你這麼說的時候很有意義:) – tyczj