Global.init() - how come Activity and not Context? - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Global.init() - how come Activity and not Context?

Global.init() - how come Activity and not Context? 2 years 2 weeks ago #11340

  • RickB
  • RickB's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0
Hi,

I'm looking at your library and I see the Global.init() function requires an Activity as the first parameter. This is a bit confusing as I wonder if I have to call the init() function on each activity?

I checked the code and it looks like it doesn't need an Activity at all - just the Context. I'd prefer to call the init() from my Application class as I use the library to read PDFs before they're even shown (so before the Activity class would call the init() function.

It looks like I could just modify the ViewLib code myself, but since that will break on an update, is this simple change something you could do?

Thanks!

Please Log in or Create an account to join the conversation.

Last edit: by RickB. Reason: typo

Global.init() - how come Activity and not Context? 2 years 2 weeks ago #11341

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Karma: 17
  • Thank you received: 65
Hi,
we have sent your post to our developers, they will check it and get back to you as soon as possible.

Please Log in or Create an account to join the conversation.

Global.init() - how come Activity and not Context? 2 years 2 weeks ago #11368

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
Dear Rick,

A new beta version 3.8.1beta2 has been published.

Global.Init accepts Context object as parameter but the Context object must be derived from ContextWrapper, otherwise it may cause a crash in the native part that is using ContextWrapper, because Context.getPackageName() is abstract method, without implementation
The following user(s) said Thank You: RickB

Please Log in or Create an account to join the conversation.

Global.init() - how come Activity and not Context? 2 years 2 weeks ago #11370

  • RickB
  • RickB's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0
Thanks Nermeen!

I appreciate both Radaee's willingness to consider improvements and your quick response! I will try this out once I have the other PDF stuff on my plate finished.

-Rick

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum