0

我想在android的第一页显示PDF文件

现在我使用下面的代码显示 PDF 文件。重新打开 pdf 后,它显示当前页面而不是重定向第一页。

如何在android中重定向PDF的第一页?

Intent intent  = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);                                
4

2 回答 2

0

我不是android专家,但你试过用android:noHistory="true"吗?您可以在清单文件中进行设置。据我了解,它会阻止您的应用程序恢复。

文档:

机器人:无历史

当用户离开它并且它不再在屏幕上可见时,是否应该从 Activity 堆栈中删除并完成(调用它的 finish() 方法)——如果应该完成,则为“true”,如果应该完成,则为“false”如果不。默认值为“假”。

“真”值意味着活动不会留下历史痕迹。它不会保留在任务的活动堆栈中,因此用户将无法返回它。

参考:http: //developer.android.com/guide/topics/manifest/activity-element.html

于 2013-09-12T07:55:03.973 回答
0

试试这个代码,

final Intent intent = new Intent(First.this, Second.class);
      intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
      startActivity(intent);

从此链接下载 pdfviewer.jar 文件。

http://www.ziddu.com/download/19248664/PdfViewer.jar.html

于 2013-09-12T07:46:42.153 回答