mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 13:30:37 +02:00
android lcl example: Advances the networking code, now almost working
git-svn-id: trunk@37615 -
This commit is contained in:
parent
27de8bc684
commit
dac7091698
@ -6,6 +6,7 @@
|
|||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
||||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
|
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
|
||||||
<application android:label="@string/app_name"
|
<application android:label="@string/app_name"
|
||||||
|
@ -384,7 +384,7 @@ begin
|
|||||||
javaMethod_HttpResponse_getEntity := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_HttpResponse, 'getEntity', '()Lorg/apache/http/HttpEntity;');
|
javaMethod_HttpResponse_getEntity := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_HttpResponse, 'getEntity', '()Lorg/apache/http/HttpEntity;');
|
||||||
javaMethod_HttpEntity_getContent := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_HttpEntity, 'getContent', '()Ljava/io/InputStream;');
|
javaMethod_HttpEntity_getContent := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_HttpEntity, 'getContent', '()Ljava/io/InputStream;');
|
||||||
javaMethod_InputStreamReader_new := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_InputStreamReader, '<init>', '(Ljava/io/InputStream;)V');
|
javaMethod_InputStreamReader_new := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_InputStreamReader, '<init>', '(Ljava/io/InputStream;)V');
|
||||||
javaMethod_BufferedReader_new := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, '<init>', '(Ljava/io/InputStream;)V');
|
javaMethod_BufferedReader_new := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, '<init>', '(Ljava/io/Reader;)V');
|
||||||
javaMethod_BufferedReader_readLine := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, 'readLine', '()Ljava/lang/String;');
|
javaMethod_BufferedReader_readLine := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, 'readLine', '()Ljava/lang/String;');
|
||||||
javaMethod_BufferedReader_close := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, 'close', '()V');
|
javaMethod_BufferedReader_close := javaEnvRef^^.GetMethodID(javaEnvRef, javaClass_BufferedReader, 'close', '()V');
|
||||||
|
|
||||||
@ -435,26 +435,30 @@ begin
|
|||||||
javaClass_InputStreamReader,
|
javaClass_InputStreamReader,
|
||||||
javaMethod_InputStreamReader_new, @lParams[0]);
|
javaMethod_InputStreamReader_new, @lParams[0]);
|
||||||
// javaBufferedReader = new BufferedReader(javaStreamReader);
|
// javaBufferedReader = new BufferedReader(javaStreamReader);
|
||||||
DebugLn(':LoadHTMLPageViaJNI 6.3');
|
DebugLn(':LoadHTMLPageViaJNI 6.3 javaStreamReader='+IntToHex(PtrInt(javaStreamReader), 8));
|
||||||
lParams[0].l := javaStreamReader;
|
lParams[0].l := javaStreamReader;
|
||||||
DebugLn(':LoadHTMLPageViaJNI 6.4');
|
DebugLn(':LoadHTMLPageViaJNI 6.4');
|
||||||
javaBufferedReader := javaEnvRef^^.NewObjectA(javaEnvRef,
|
javaBufferedReader := javaEnvRef^^.NewObjectA(javaEnvRef,
|
||||||
javaClass_BufferedReader,
|
javaClass_BufferedReader,
|
||||||
javaMethod_BufferedReader_new, @lParams[0]);
|
javaMethod_BufferedReader_new, @lParams[0]);
|
||||||
|
|
||||||
DebugLn(':LoadHTMLPageViaJNI 7');
|
DebugLn(':LoadHTMLPageViaJNI 7 javaBufferedReader='+IntToHex(PtrInt(javaBufferedReader), 8));
|
||||||
// String line = "";
|
// String line = "";
|
||||||
// while ((line = javaBufferedReader.readLine()) != null) {
|
// while ((line = javaBufferedReader.readLine()) != null) {
|
||||||
// }
|
// }
|
||||||
while True do
|
while True do
|
||||||
begin
|
begin
|
||||||
|
DebugLn(':LoadHTMLPageViaJNI 7.1');
|
||||||
javaString := javaEnvRef^^.CallObjectMethod(javaEnvRef, javaBufferedReader,
|
javaString := javaEnvRef^^.CallObjectMethod(javaEnvRef, javaBufferedReader,
|
||||||
javaMethod_BufferedReader_readLine);
|
javaMethod_BufferedReader_readLine);
|
||||||
|
DebugLn(':LoadHTMLPageViaJNI 7.2');
|
||||||
if javaString = nil then Break;
|
if javaString = nil then Break;
|
||||||
|
DebugLn(':LoadHTMLPageViaJNI 7.3');
|
||||||
lNativeString := javaEnvRef^^.GetStringUTFChars(javaEnvRef, JavaString, nil);
|
lNativeString := javaEnvRef^^.GetStringUTFChars(javaEnvRef, JavaString, nil);
|
||||||
DebugLn(lNativeString);
|
DebugLn(lNativeString);
|
||||||
Result := lNativeString;
|
Result := lNativeString;
|
||||||
javaEnvRef^^.ReleaseStringUTFChars(javaEnvRef, JavaString, lNativeString);
|
javaEnvRef^^.ReleaseStringUTFChars(javaEnvRef, JavaString, lNativeString);
|
||||||
|
DebugLn(':LoadHTMLPageViaJNI 7.4');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DebugLn(':LoadHTMLPageViaJNI 8');
|
DebugLn(':LoadHTMLPageViaJNI 8');
|
||||||
|
Loading…
Reference in New Issue
Block a user