Forum > Android

Android API

(1/4) > >>

Is there any Android API pascal translation for camera, phone book, etc ... using Android Native SDK?

The FPC JVM backend port with Android target has them.


--- Quote from: plusplus on February 04, 2012, 12:28:31 am ---Is there any Android API pascal translation for camera, phone book, etc ... using Android Native SDK?

--- End quote ---

To start with: How are you writing your application? Is it a Pascal shared object?

"Android Native SDK" is a confusing term. Android has 2 sets of APIs: NDK and SDK

Supposing you are talking about the NDK, all translations I have so far are here:

But that does not include camera nor phone book.  I think that camera only came in a very recent NDK, if at all, and likely phone book is not in the NDK at all. I am targeting Android 2.2+ so I don't have the latest NDK APIs, but I am not sure if those are really that useful anyway.

For SDK APIs, which are the vast majority in Android, you can access all of them either directly from JNI, which works very nicely for simple method calls, but often Android APIs require some wierd syntax, creating classes on the fly and adding methods to handle things on the fly, implementing interfaces, etc ... so if you are facing problematic syntax then you can create a Java method which does the service and you call it via JNI, like this:

In some places I could have done the direct JNI method, but when I wrote those I didn't jet know how how to call methods in parameters in JNI, but now I already mastered that, so in the future the LCL will likely see more direct calls.

@felipemdc as I always say, you the man.

another question, I am using LCL Android but I can make the form black, how can I make the from background black?


found it, you can change it in common_draw

pascal side I have

--- Code: ---
procedure TCDWidgetSet.LazDeviceAPIs_OpenUrl(url: string);
  lJavaString: jstring;
  lStr: String;
  lStr := url;
  lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, PChar(lStr));
  javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltext, lJavaString);
  javaEnvRef^^.CallVoidMethod(javaEnvRef, javaActivityObject, javaMethod_LCLDoOpenUrl);

--- End code ---

and on the java side I have

--- Code: ---public void LCLDoOpenUrl(String url)
  Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));

--- End code ---

when I make the call, the app exits without any warning, what am I doing wrong here?


Solved, had forgotten to assign and initialize the Java Method


[0] Message Index

[#] Next page

Go to full version