我需要在我的安卓应用中展示一个本地的pdf文件,这个pdf文件需要被包含在我的应用程序包中。我已经有了这个文件,但是我不知道如何构建一个
File
类。public void loadreglamento(View v){
//Im supposed to give a path with the file but I really dont know how
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
这段代码对我来说是可以的,我不在乎用户是否使用外部查看器或编辑器查看文档。
我还需要知道在哪里复制PDF文件。
提前致谢。