[英]Read pdf in Android Studio
我会在项目中阅读pdf文件。 步骤1:在哪里输入PDF文件? 在哪个文件夹中? 第2步:如何阅读? 我只需要打开它。
我找到了此代码,但给我一个错误:文件si的目录错误
protected void openPdf()
{
Intent intent = new Intent(Intent.ACTION_VIEW);
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+" /PDF";
File file = new File(path, "law.pdf");
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
startActivity(intent);
}
更换线
字符串路径= Environment.getExternalStorageDirectory()。getAbsolutePath()+“ / PDF”;
到String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.