oh, that's right, it slipped my mind , thank you very much.
Hello, I know I'm a bit heavy, but I can't understand the errors. I have fixed the ";" and I get the following error:
Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml
extensions:
clean:
init:
common_CommonUtils:
init:
CommonUtils:
common_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128CopyToRunLibDir:
components_AndroidRuntime:
init:
CommonConstants:
[javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warningHtmlEntities:
[javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warningcommon_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128AndroidRuntime:
[javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/meulencv/Get_source_web/Get_source_web.java:93: error: cannot find symbol
[javac] myEvent(finalData); // You're event with data
[javac] ^
[javac] symbol: method myEvent(String)
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/meulencv/Get_source_web/Get_source_web.java:90: error: cannot find symbol
[javac] activity.runOnUiThread(new Runnable() { // Always raise events on UI thread
[javac] ^
[javac] symbol: variable activity
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warningBUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.Total time: 7 seconds
cts/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/meulencv/Get_source_web/Get_source_web.java:93: error: cannot find symbol
[javac] myEvent(finalData); // You're event with data
[javac] ^
[javac] symbol: method myEvent(String)
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/meulencv/Get_source_web/Get_source_web.java:90: error: cannot find symbol
[javac] activity.runOnUiThread(new Runnable() { // Always raise events on UI thread
[javac] ^
[javac] symbol: variable activity
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warningBUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.Total time: 6 seconds
I don't find the resolution of the errors on the internet
Your code have two errors:
- you haven't declared and initialized activity
- there is no myEvent method in your code
You should use a Java IDE.
This can be done with AI2 Blocks, just join view-source:
before the http
part?
Still, it's okay for learning
But I ned to do this, to later do the extension more complex, for example a extension that gives the bitcoin price.
Hello,
I would be very grateful if you could fix my code, thank you very much
I have the demo extension code which works.
Demo code
File name: Request.java
package com.kumaraswamy.request;
import android.app.Activity;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import com.google.appinventor.components.runtime.util.AsynchUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
@DesignerComponent(version = 1,
category = ComponentCategory.EXTENSION,
description = "Made my YOU",
nonVisible = true,
iconName = "ICON LINK")
@SimpleObject(external = true)
public class Request extends AndroidNonvisibleComponent {
private Activity activity;
public Request(ComponentContainer container) {
super(container.$form());
activity = container.$context();
}
@SimpleFunction
public void DoRequest(final String website) {
AsynchUtil.runAsynchronously(new Runnable() {
@Override
public void run() {
BufferedReader in;
try {
in = new BufferedReader(
new InputStreamReader(
new URL(website).openStream()));
String inputLine;
final StringBuilder result = new StringBuilder();
while ((inputLine = in.readLine()) != null)
result.append(inputLine);
in.close();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
GotResult(result.toString());
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
@SimpleEvent
public void GotResult(String result) {
EventDispatcher.dispatchEvent(this, "GotResult", result);
}
}
Thank you very much with all my heart @Kumaraswamy , I don't know how to thank you. IT WORKS!
used your code and got compile error in kodular
Kodular is unable to compile this project.
The compiler error output was
________Preparing application icon
________Creating animation xml
________Creating fragment xml
________Creating listview xml in res/layout/..
________Creating listview xml in res/layout-v21/..
________Creating xml in res/drawable/..
________Creating splash png in res/drawable/..
________Creating colors xml
________Creating styles xml
________Creating drawables xml v21
________Checking for firebase
________Creating provider_path xml
________Creating network_security_config xml
________Generating adaptive icon file
________Generating round adaptive icon file
________Generating adaptive icon background file
________Generating manifest file
________Attaching native libraries
________Attaching Android Archive (AAR) libraries
________Attaching component assets
________Invoking AAPT
AAPT time: 1.217 seconds
________Compiling source files
.
I'm solving the problem
I have solved the problem, thank you very much for the warning.
It's not the fault of the extension, I have compiled the code over two times...
Extensions. I added this extension to an empty project and it hasn't compiled anymore.
Hi, it compiles correctly for me and the app works on the mobile. Have you tried v2 of the extension?
It do like web scrapping,
When the extension get the source of the web page, it cut a part of the source to get the value like (btc price)