RadaeePDF.com :: Topic: NPE in annotation.setIcon(String, PageContent) (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: NPE in annotation.setIcon(String, PageContent)

NPE in annotation.setIcon(String, PageContent) 2 years 8 months ago #7616

  • Gomiero
  • Gomiero's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 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) 2 years 8 months ago #7618

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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: 2 years 8 months ago by .
The topic has been locked.

NPE in annotation.setIcon(String, PageContent) 2 years 8 months ago #7623

  • Gomiero
  • Gomiero's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 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.
Powered by Kunena Forum