2013-11-28 164 views
1

我的资产文件夹:enter image description hereAndroid的资产文件夹路径PDF

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "PDF FILE PATH"); startActivity(intent);

如何获得路径?

回答

0

尝试使用:

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "file:///android_asset/xy.pdf"); startActivity(intent); 
0

试试这个

Uri path = Uri.parse("file:///android_asset/about.pdf"); 
Intent intent = new Intent(Intent.ACTION_VIEW); 
intent.setDataAndType(path, "application/pdf"); 
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
startActivity(intent); 
+0

我用你的代码,但它提醒 '无效的文件路径',为什么呢? – JackSun

+0

这是无效的,因为在apk获得设备时资产不是文件。 –

相关问题