【问题标题】:How to open current activity current application from my application Android如何从我的应用程序 Android 打开当前活动当前应用程序
【发布时间】:2015-11-18 07:30:21
【问题描述】:

我正在开发具有打印无线功能的新应用程序。我正在使用 ePrint 技术。我之前生成的 PDF 文件,我想直接使用 ePrint 应用程序(apk)预览它,如下图所示:

我有我的 pdf 文件的 URI,然后我已经反编译了 ePrint 应用程序 (apk),并在其清单中找到了这个。我不确定,但我认为下面的截图是指预览活动。

那么如何从我的应用程序中直接打开 ePrint Preview 活动,并且我有要打印的参数 URI 文件?

提前谢谢你。

【问题讨论】:

标签: android android-intent android-activity uri


【解决方案1】:

试试这个: 以下代码可能会解决您的问题。

只有当你的库中有ACTION_PRINT 时它才会起作用。

File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/pdf_name.pdf");
Intent intent = new Intent();
intent.setAction("org.androidprinting.intent.ACTION_PRINT");
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);

【讨论】:

  • 如何从我的URI参数直接预览我的pdf文件?
  • FATAL EXCEPTION: main android.content.ActivityNotFoundException: No Activity found to handle Intent { act=org.androidprinting.intent.ACTION_PRINT flg=0x10000000 } 已经使用了您的代码,并收到此错误:跨度>
  • 你到底想做什么?
  • 从我的应用程序中打开另一个应用程序,但直接打印预览活动
猜你喜欢
  • 1970-01-01
  • 2019-08-01
  • 1970-01-01
  • 2012-07-13
  • 1970-01-01
  • 2013-11-11
  • 2012-12-21
  • 2016-03-29
  • 1970-01-01
相关资源
最近更新 更多