File tree 3 files changed +28
-20
lines changed
java/com/yokara/javascriptcalljava
3 files changed +28
-20
lines changed Original file line number Diff line number Diff line change 43
43
</script>
44
44
45
45
### notice :
46
- #### You can do anything with Javascript Interface when button in function ` showToast() ` of class ` WebInterFace ` in the top of this README
46
+ #### You can do anything with Javascript Interface when ` button clicked ` in function ` showToast() ` of class ` WebInterFace ` in the top of this README
47
+
48
+
49
+ Demo https://youtu.be/3wHA3dh8k-g
Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
+
3
4
< head >
4
5
< meta charset ="UTF-8 ">
5
6
< title > just tesst</ title >
6
7
< script >
7
- function myFunction ( ) {
8
- document . getElementById ( "huu" ) . innerHTML = "New from asstes folder tee23xt2!" ;
9
- document . getElementById ( "huu" ) . style . color = "green" ;
10
-
11
-
12
- }
13
- function myFunction2 ( ) {
14
- document . getElementById ( "huu2" ) . innerHTML = "New text3!z2" ;
15
- alert ( "Hello! I am an alert box!!" ) ;
8
+ function myFunction ( ) {
9
+ document . getElementById ( "huu" ) . innerHTML = "New from asstes folder tee23xt2!" ;
10
+ document . getElementById ( "huu" ) . style . color = "green" ;
16
11
17
12
18
- }
19
- function androiToast ( ) {
20
- toaskAction . showToast ( ) ;
21
-
22
- }
13
+ }
23
14
15
+ function myFunction2 ( ) {
16
+ document . getElementById ( "huu2" ) . innerHTML = "New text3!z2" ;
17
+ alert ( "Hello! I am an alert box!!" ) ;
24
18
25
19
20
+ }
26
21
22
+ function androiToast ( ) {
23
+ toaskAction . showToast ( ) ;
27
24
25
+ }
28
26
27
+ function kaka ( ) {
28
+ toaskAction . kaka ( ) ;
29
+ }
29
30
30
31
</ script >
31
32
</ head >
33
+
32
34
< body >
33
35
< button onclick ="myFunction() "> Copy Text</ button >
34
36
< button onclick ="myFunction2() "> Copy Text</ button >
35
37
< button onclick ="androiToast() "> Android Toast</ button >
36
-
37
-
38
+ < button onclick ="kaka() "> kaka</ button >
38
39
< h1 id ="huu "> a</ h1 >
39
40
< h1 id ="huu2 "> a</ h1 >
40
-
41
-
42
41
</ body >
43
- </ html >
42
+
43
+ </ html >
Original file line number Diff line number Diff line change @@ -87,5 +87,10 @@ public void showToast() {
87
87
progressDialog .setTitle ("javascript" );
88
88
progressDialog .show ();
89
89
}
90
+
91
+ @ JavascriptInterface
92
+ public void kaka (){
93
+ Toast .makeText (MainActivity .this , "hehe button" , Toast .LENGTH_SHORT ).show ();
94
+ }
90
95
}
91
96
}
You can’t perform that action at this time.
0 commit comments