whether it is possible to choose the version arm-android
translation examples
andoridlcl I just managed with FPC-2.5.1
JNI example can to work only with FPC-2.5.1
if you can help out send HTML code and read the answer
request (nativetest.pas) and response (webpage.java)
the laz4android it works
I install: WinXp 32, Lazarus BigIDE, arm-android
how to work with CodeTyphon 4.10
library nativetest;
{$mode delphi}
uses jni;
const curVM:JClass=nil;
function strFromJNI(env:PJNIEnv; this:jobject): JString; cdecl;
var
Str: string;
begin
Str := '<html><body>Hello, world!</body> </html>';
Result := PEnv^.NewStringUTF(PEnv, PChar(Str));
end;
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; cdecl;
begin
curVM:=vm;
result:=JNI_VERSION_1_6;
end;
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); cdecl;
begin
end;
exports
JNI_OnLoad name 'JNI_OnLoad',
JNI_OnUnload name 'JNI_OnUnload',
strFromJNI name 'Java_com_pascal_systeminfo_webpage_strFromJNI';
begin
end. | package com.pascal.systeminfo;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.Date;
public class webpage extends Activity {
WebView browser;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
browser=(WebView)findViewById(R.id.webkit);
try {
browser.loadData(strFromJNI(),"text/html", null);
} catch(UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
}
/**
*/
public native String strFromJNI();
/**
*/
public long nativeCodeLoaded=0;
static {
try {
System.loadLibrary("nativetest");
} catch(UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
} |