Android Tutorial Inline Java Code

Lee Gillie CCP

Active Member
Licensed User
Longtime User
ok.... I see now...
B4X:
    'lower cased module name
    NativeMe.InitializeStatic(Application.PackageName & ".globals")
instead.... but still failing....
 

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Found my issue. My problem is that I created B4A code and looked at the Java created from it, and tried to model after that. It really wants you to use native java, and it magically performs any conversions.

B4X:
#if JAVA
import java.util.*;
public static List GetStackTraceJava()
{
    List jlst = new ArrayList();
    jlst.add("Test 1");
    jlst.add("Test 2");
    return jlst;
}
#End If

And the above works perfectly.

The other lesson learned is that initialization for Class and Module differs. You gotta pay attention and study the download samples from Inline Java tutorial. Resolving class members is a different process apparently than resolving module methods.
 
Last edited:

jcohedman

Member
Licensed User
Longtime User

I'm working with images, using imagej http://imagej.nih.gov/ij/ . I use #AdditionalJar: ij (ij.jar), and at least I can open an image...
 

mshafiee110

Active Member
Licensed User
Longtime User
Hi.
How to know which button was clicked?
 

MarcoRome

Expert
Licensed User
Longtime User

MarcoRome

Expert
Licensed User
Longtime User

??
There are many tutorials on the net that you can read ( LINK )
And...also our great @Johan Schoeman he has written several tutorial. For example you can watch this ( LINK )
 

walterf25

Expert
Licensed User
Longtime User
How about _onOptionsItemSelected(MenuItem item)
does this hook exist and can it be called in B4A?

Thanks,
Walter
 

MarcoRome

Expert
Licensed User
Longtime User

Example lib using JavaObject:
Accesing third party Jar with #Additionaljar and JavaObject - Picasso by @Erel
Android Speech Recognition API Wrapper by @stevel05
PDFDocument API 19+ by @stevel05


For next question ( "after the compiling succefully a library with java inline code using JavaObject why in the call of library(on press a button call code from library) will say the method java ,inline,wasn't found then apk will crash?" )
Open new thread and put more details ( type error log, code that you use, etc )

 

stari

Active Member
Licensed User
Longtime User
I had the same problem. Tools - Clean Projekt solves the problem.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…