Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

NPE in annotation.setIcon(String, PageContent)

More
IP: 192.168.0.71 11 years 2 months ago #7616 by Gomiero
Hi all,
I have a NullPointerException in method PageContent.DrawImage(ResImage) when I use Annotation.setIcon(String, PageContent). My code is:
Code:
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.ic_media_image); PageContent p = new PageContent(); p.Create(); DocImage di = mDoc.NewImage(b, true); annotation.SetIcon("short text", p); p.DrawImage(page.AddResImage(di));
Particularly the method Page.AddResImage(DocImage) returns null because the native method addResImage(int, int) returns 0.
Library version is 3.0

What do I wrong?

Thanks.
More
IP: 192.168.0.71 11 years 2 months ago - 11 years 2 months ago #7618 by radaee
you can use Page.AddAnnotBitmap instead.
Page.AddAnnotBitmap and mDoc.NewImage(b, true) need you call Document.setCache() after Document.Open();

at last: Bitmap to be add, must be RGBA32 format, otherwise failed.
Last edit: 11 years 2 months ago by .
More
IP: 192.168.0.71 11 years 2 months ago #7623 by Gomiero
Thank you for the response :)
After Page.AddAnnotBitmap I must call view.vRenderXXX, correctly? What should I choose between view.vRenderSync and view.vRenderAsync? And why?

Thanks
Time to create page: 0.408 seconds
Powered by Kunena Forum