如何从我目前的应用程序中打开Android中的PrinterShare应用从我、应用程序、目前、PrinterShare

2023-09-05 00:13:36 作者:烈酒烫喉,

由于我开发一个Android应用程序,我碰到启动安装在我的Andr​​oid手机上了PrinterShare应用程序的需要。我想,当用户点击按钮控制在我的应用程序,它应该启动的PrinterShare应用程序。当用户与他/她需要打印的文档做了,那么就应该回来家庭应用,从当它被推出。

任何想法,code段将AP preciated。 谢谢..: - )

解决方案

最近,但幸运的是我得到的答案。 在这里,它是:

 意向书我=新的意图(Intent.ACTION_VIEW);
i.setPackage(com.dynamixsoftware.printershare);
i.setDataAndType(printFileUri,text / plain的);
startActivity(ⅰ);
 

其中printFileUri如下:

  static final的乌里printFileUri = Uri.parse(文件:///sdcard/Calci_print.txt);
 

如果任何人有另一种建议,其最欢迎..: - )

细数十个有关Android 6.0的秘密

As I am developing an android app, I came across the need of launching the PrinterShare app installed on my android phone. I want that when user hits the Button control in my app, it should launch the PrinterShare app. When user is done with the document which he/she needs to print, then it should come back to home application, from when it was launched.

Any idea, code snippet would be appreciated. Thanks.. :-)

解决方案

Lately but fortunately I got the answer. Here it is:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setPackage("com.dynamixsoftware.printershare");
i.setDataAndType(printFileUri,"text/plain");
startActivity(i);

where 'printFileUri' is as follows:

static final Uri printFileUri = Uri.parse("file:///sdcard/Calci_print.txt");

If anyone has still another suggestion, its most welcomed.. :-)