How to print Android activity display using cloud print

浪尽此生 提交于 2019-12-11 02:06:37

问题


I am trying to implement Google Cloud Print into an app, following the Integration Guide. I'm trying to keep it basic by just printing out google.com. When clicking the print button I created, it brings up the dialog, but I am getting a FileNotFoundException stating

java.io.FileNotFoundException: No content provider: http://www.google.com

If I then select a printer and click print, the dialog gives me a "Document Missing" message, which makes sense based on the FileNotFoundException.

I took print_dialog.xml and PrintDialogActivity.java verbatim from the guide. Here is my code calling the activity:

Intent printIntent = new Intent(getActivity(), PrintDialogActivity.class);
Uri docUri = Uri.parse("http://www.google.com");
printIntent.setDataAndType(docUri, "text/html");
printIntent.putExtra("title", "Google");
startActivity(printIntent);

I'm attempting to figure out how to print a web page, but would eventually like to be able to print the activity display.

So my question is: What do I need to do in order to print a webpage or activity display?


回答1:


Try to add the following to your application manifest

<uses-permission android:name="android.permission.INTERNET" />


来源:https://stackoverflow.com/questions/13725122/how-to-print-android-activity-display-using-cloud-print

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!