Android IDE (AIDE) Support Forum

Using JavaScript Code

How to make use of JavaScript in AIDE compiler under Gridle/Android SDK/Java/XML platform ?

1 Like

Here pal : https://play.google.com/store/apps/details?id=com.aide.web

They have a separate app for web development with the ability to code in javascript, html and css

1 Like

You can try using WebView:

WebView page = findViewById(R.id.something);
page.getSettings().setJavascriptEnabled(true);

//use this code to translate java to javascript
page.addJavascriptInterface(new MyObject(),"Object");

So you can use:

Object.myFunction("1",2,0b11);

But first define your function:

@JavascriptInterface public void myFunction(String a, int b, int c) {
    new Toast.makeText(myActivity,a + " " + b + " " + c, 1000);
}

Caution

The only supported Classes is void, String, int and some of Object (cant use new Object() method).

4 Likes

Thanks for the code, im interested in webviewon android

WebView page = findViewById(R.id.something);
page.getSettings().setJavascriptEnabled(true);

//use this code to translate java to javascript
page.addJavascriptInterface(new MyObject(),“Object”);

1 Like