Java Question Please share Eclipse project showing how to wrap .jar library for B4A

bloxa69

Active Member
Licensed User
Longtime User
Hello experts!
Please share Eclipse project showing how to wrap .jar library for B4A.
I am sure many big guns out here have dealt with external libraries and wrapping them for B4A. Many people, including myself, struggle with that. Please share your project and help the community. :sign0188::sign0163:

Also, if anyone has any ideas on how to hardware accelerate live wallpapers from within B4A, any suggestions will be greatly appreciated. I am trying to wrap GLWallpaperService library, but didn't go far with it yet.

I've also tried to adapt existing B4A libraries (OpenGL ES 2D Image Lib, GameView Lib) to work from withing WallpaperService but didn't succeed, may be it's not even possible? I know there are some libraries out there extending Android Game libraries to work with LWP, so I thought maybe it's possible to extend, lets say, B4A GameView library to work with LWP? (By the way, many thanks to Erel for GameView - works like a charm, and Jim Brown for OpenGL ES - 2D Image Library, and Andrew Graham for OpenGL Lib)
 

bloxa69

Active Member
Licensed User
Longtime User
GameView will not work with WallPaperService.

How about extending GLSurfaceView for LWP? Seems easy in Java (forgive me my ignorance ), and there is B4A OpenGL Lib that provides GLSurfaceView.
As far as I understand, all we need is to override getHolder() to call [WallpaperService.Engine].getSurfaceHolder() to get the surface that’s associated with the live wallpaper.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Here is the source to my Dropbox Wrapper which only wraps the authentication side.
Honestly, I think this code will do you no good, because every wrapper and every library is different.
In order to wrap a library, you need to find out how it works in java first, and then create accessible methods for those in the wrapper, and call those methods at the right time in your B4A project.
In a way it is easy once you get the hang of it, but there are no shortcuts.
Most of the people here learn by trial and error which is why there are not too many tutorials. (For e.g. now my eclipse isnt working with ADT, and I have no idea how to fix it!)
I can see your panic, asking for library source in every thread but I think you are better off getting jd-gui and self-studying other libraries.
 

Attachments

  • DropboxWrapper.zip
    8.2 KB · Views: 320

bloxa69

Active Member
Licensed User
Longtime User
Hey, thedesolatesoul, thanks a lot for sharing - i am not alone and it will help many people. I personally stuck without HW accelerated LWP that I must include in almost every of my app. It's not available in B4A, so I am trying to wrap it myself.

I think you are better off getting jd-gui and self-studying other libraries.

That's exactly right and I already got it a couple of days ago and started checking existing libraries. Still, for somebody like me, whose Java knowledge is not so great, all those are a bit over the head. That's why I am begging everywhere for a sample (and possibly simple) Eclipse project showing how to wrap a (simple) library, a simple tutorial on how to export it, initialize it in B4A project and use methods and properties from withing B4A. That might help us to put the peaces of puzzle together and make sense out of all chunks of code and knowledge we get here and there.

:sign0188:
 
Last edited:

thedesolatesoul

Expert
Licensed User
Longtime User
That's exactly right and I already got it a couple of days ago and started checking existing libraries. Still, for somebody like me, whose Java knowledge is not so great, all those are a bit over the head. That's why I am begging everywhere for a sample (and possibly simple) Eclipse project showing how to wrap a (simple) library, a simple tutorial on how to export it, initialize it in B4A project and use methods and properties from withing B4A. That might help us to put the peaces of puzzle together and make sense out of all chunks of code and knowledge we get here and there.
But again this approach is not an alternative to picking up a java book and reading it. You will keep coming back with more and more questions without knowing the details of java. Most of the people here who ported complicated libraries were either banging their heads against the forum (eventually got it) or they picked up a book and learnt themselves.
Also remember every library is different, so the simple ones will not help you with complicated java libs.
Best of luck anyway!
 

moster67

Expert
Licensed User
Longtime User
I agree with thedesolatesoul. I struggled with my libraries and every wrapper is a story of its own. "Trial and error" got me where I wanted.

The other option is to post a request in the "Job offer" section of this forum. There are many talented people here in the forum who perhaps against a fee would gladly give it a try.

..and before you ask, I am not one of those "talented" people :)

Good luck.
 

bloxa69

Active Member
Licensed User
Longtime User
Hey guys, thanks for a quick reply. You are absolutely right.
I only wish I had time for books or money for hired guns. I am using B4A 'cause I ain't got neither.
So, I'll just bang my head on the wall until something comes out of it. Or wait for talented guys who develop HW accelerated LWP library for B4A. Or port my B4A code to Java and work on my LWPs in Eclipse.
By the way, strangely enough, doing what I need in Java seems much easier than in B4A, I did a couple of HW accelerated LWPs in Eclipse without pulling my hair. Go figure.

:BangHead::BangHead::BangHead:
 
Top