Java Question Sample code of java library using in B4A

gkumar

Active Member
Licensed User
Longtime User
I wanted a sample project in java eclipse IDE, which is used in B4a as a library. I just wanted evalauate more on this aspect. Anybody having the sample code and steps?
 

warwound

Expert
Licensed User
Longtime User
You can grab the eclipse project for an old version of my TabHostExtras library here: http://www.b4x.com/forum/additional-libraries-official-updates/11056-tabhostextras-3.html#post81812.

And a template example of using the B4A ViewWrapper class can be found here: http://www.b4x.com/forum/libraries-developers-questions/15849-ambitious-first-library.html#post90889.

You can also download JD-GUI and use it to decompile existing JAR libraries.
A lot of B4A library developers seem to have found it very useful to look at other people's library code with this tool.
You can look at the source code for 3rd party libraries as well as the official B4A Core.jar library.

Martin.
 

thedesolatesoul

Expert
Licensed User
Longtime User
You can grab the eclipse project for an old version of my TabHostExtras library here: http://www.b4x.com/forum/additional-libraries-official-updates/11056-tabhostextras-3.html#post81812.

And a template example of using the B4A ViewWrapper class can be found here: http://www.b4x.com/forum/libraries-developers-questions/15849-ambitious-first-library.html#post90889.

You can also download JD-GUI and use it to decompile existing JAR libraries.
A lot of B4A library developers seem to have found it very useful to look at other people's library code with this tool.
You can look at the source code for 3rd party libraries as well as the official B4A Core.jar library.

Martin.

While, that is all good for learning, make sure you do not redistribute or post code from other libraries without asking prior permission first. While most developers would be happy for you to use it, you might get into trouble for doing something you should not.
 

gkumar

Active Member
Licensed User
Longtime User
Error in the sample

I downloaded the TabHost example and includes required 3 jar files, But displays error while application build.

Exception in thread "main" java.lang.RuntimeException: Stub!
at dalvik.system.TouchDex.main(TouchDex.java:6)

Is there any other simple hello world application which used in B4a as library?
 

warwound

Expert
Licensed User
Longtime User
I downloaded the TabHost example and includes required 3 jar files, But displays error while application build.

Exception in thread "main" java.lang.RuntimeException: Stub!
at dalvik.system.TouchDex.main(TouchDex.java:6)

Is there any other simple hello world application which used in B4a as library?

That's an error from the B4A IDE and NOT an Eclipse error is it?
If so can you ZIP your project and upload it?

What sort of library would you like to write?

  • A library that is a visual component - an Android View?
  • A library that contains just static functions which are used to perform tasks on B4A objects?
    (TabHostExtras is such a library)
  • A library that wraps a 3rd party native Android library so it can be used in B4A?

Martin.
 

warwound

Expert
Licensed User
Longtime User
Ah ha...!

Delete the file TabHostExtrasTemp.java and recompile your project and re-generate the XML file.

That file was included just as it contained some other code that someone wanted to see - it's not needed and if included will create a broken library.

You could not delete it - instead right click TabHostExtras.java and Export, right click it again and Generate Javadoc.
That will compile without including the Temp file.

Martin.
 

gkumar

Active Member
Licensed User
Longtime User
Not compiling without any error

Error was in java file compilation. After removing the file now the application compiles without any error. I will update more on this later.
 
Top