question

Bryanne Vega avatar image
Bryanne Vega asked Bryanne Vega commented

NullPointerException ImagePrintJob

Trying to print a valid image returns a nullpointer exception when the image is being processed, I found that getting the image's "absolute path" returns null, although I'm providing an image from memory:

RelativeLayout > DrawableCache > Bitmap

new ImagePrintJob.builder().bitmap(image).maxwidth().build.print(getContext,account);

I use getContext hence i'm inside a fragment.

The error I'm facing is "Unfortunately, Clover has stopped"

12 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Stack trace?

0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·

http://pastebin.com/UUGcCGX1

Code:

ListView apList = (ListView) getActivity().findViewById(R.id.accessPointsList);
Bitmap b = apList.getDrawingCache();
 new ImagePrintJob.Builder().bitmap(b).maxWidth().build().print(getActivity().getApplicationContext(),account);

Note: I'm calling this manually by clicking a button, making sure the ListView is actually there thus returns a valid image.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Thanks. Do you have the entire logcat for context around the crash?

0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·
0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Ok, it cannot create the temp file to store the image data. Is this on a Clover device? It is trying to create a temp file called image-<random stuff>.png under /sdcard/clover/image-print. Can you look on the file system to see if this path exists?

0 Likes 0 ·
Show more comments

0 Answers

Welcome to the
Clover Developer Community