-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWebView.txt
More file actions
executable file
·35 lines (28 loc) · 1 KB
/
WebView.txt
File metadata and controls
executable file
·35 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class ContentActivity extends AppCompatActivity {
WebView wv_content;
String url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_content);
wv_content = (WebView) findViewById(R.id.wv_content);
int mon = getIntent().getIntExtra("position", 0);
url = "file:///android_asset/" + mon + ".html";
wv_content.getSettings().setJavaScriptEnabled(true);
wv_content.loadUrl(url);
wv_content.setWebViewClient(new MyBrower());
ads();
}
private void ads() {
AdView avBanner =(AdView)findViewById(R.id.av_banner);
AdRequest adRequest = new AdRequest.Builder().build();
avBanner.loadAd(adRequest);
}
private class MyBrower extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}