Skip to content

Commit

Permalink
Merge pull request #272 from thorjay/master
Browse files Browse the repository at this point in the history
修复CustomWebview的问题和使用步骤&新增当前js与java调用机制
  • Loading branch information
uknownothingsnow authored May 13, 2024
2 parents 124af30 + 44f5c65 commit a0239f1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Binary file added JsBridgeWork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This project make a bridge between Java and JavaScript.

It provides safe and convenient way to call Java code from js and call js code from java.

## How JsBridge Work
![JsBridge](./JsBridgeWork.png)

## Demo
![JsBridge Demo](https://raw.githubusercontent.com/lzyzsd/JsBridge/master/JsBridge.gif)

Expand Down Expand Up @@ -126,6 +129,22 @@ for example:

will print 'JS got a message hello' and 'JS responding with' in webview console.

### Switch to CustomWebview
* activity_main.xml
```xml
<com.github.lzyzsd.jsbridge.example.CustomWebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.github.lzyzsd.jsbridge.example.CustomWebView>
```
* MainActivity.java
Class BridgeWebview change to CustomWebview;
```java
CustomWebView webView = (CustomWebView) findViewById(R.id.webView);

```

## Notice

This lib will inject a WebViewJavascriptBridge Object to window object.
Expand Down

0 comments on commit a0239f1

Please sign in to comment.