Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

NPE in annotation.setIcon(String, PageContent) 9 years 5 months ago #7616

  • Gomiero
  • Gomiero's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi all,
I have a NullPointerException in method PageContent.DrawImage(ResImage) when I use Annotation.setIcon(String, PageContent). My code is:
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.
The topic has been locked.

NPE in annotation.setIcon(String, PageContent) 9 years 5 months ago #7618

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
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: by .
The topic has been locked.

NPE in annotation.setIcon(String, PageContent) 9 years 5 months ago #7623

  • Gomiero
  • Gomiero's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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
The topic has been locked.
  • Page:
  • 1
Powered by Kunena Forum