Print image in android

只愿长相守 提交于 2019-12-30 13:29:22

问题


I am using the below code to send the command to the printer. The temp folder is created and the file is sent to the folder. but it gives me an error saying `

"No activity found to handle the intent( act=com.dynamixsoftware.printershare.print dat=file:///mnt/sdcard/temp/picture1230841297.stream typ=application/x-android-picture-stream (has extras) } "

The code is

    public static boolean queuePictureStreamForPrinting( Context context, File f )
    {
        // send to print activity
        Uri uri = Uri.fromFile( f );
        Intent i = new Intent( PRINT_ACTION );
        i.setDataAndType( uri, "application/x-android-picture-stream" );
        i.putExtra( "scaleFitToPage", true );
        context.startActivity( i );

        return true;
    }

Any suggestions on what am missing?


回答1:


You are missing an app, that is actually able to use that print-intent you are trying to start. Install whatever can receive com.dynamixsoftware.printershare.print intents. If this is already installed, make sure the uri and mime-type make sense to that app.

An intent is only a signal to do some job. It will be dispatched at runtime, so there is no compile time checking for errors. This also allows the user in some cases (e.g. send by email) to choose between multiple possible receivers




回答2:


check your code once....!!whether the intent is registered in manifest with proper action and category...!!



来源:https://stackoverflow.com/questions/8726168/print-image-in-android

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