Skip to content

Commit 8af558f

Browse files
committed
Added a few comments for clarity.
1 parent 3637787 commit 8af558f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/com/scottagarman/android/jsexample/JsExampleMain.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ public void onCreate(Bundle savedInstanceState) {
2222
wv.getSettings().setJavaScriptEnabled(true);
2323

2424
//add interface
25-
wv.addJavascriptInterface(jsInterface, "android");
25+
wv.addJavascriptInterface(jsInterface, "android");//android is the keyword that will be exposed in js
2626

2727
//load file
2828
wv.loadUrl("file:///android_asset/test.html");
2929
}
3030

31-
//interface
31+
//javascript interface
3232
private class JsInterface{
33+
//function that will be called from assets/test.js
34+
//js example: android.log('my message');
3335
public void log(String msg){
3436
Log.d("MSG FROM JAVASCRIPT", msg);
3537
}

0 commit comments

Comments
 (0)