问题
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