package com.webview.demo;
 2 
 3 import android.os.Bundle;
 4 import android.support.v7.app.AppCompatActivity;
 5 import android.webkit.WebView;
 6 
 7 import java.util.HashMap;
 8 import java.util.Map;
 9 
10 public class MainActivity extends AppCompatActivity {
11 
12     private WebView webView ;
13 
14     private String webViewHeaderKey = "tokenId" ;
15     private String webViewHeaderValue = "562142" ;
16 
17     private String url = "" ;
18 
19     @Override
20     protected void onCreate(Bundle savedInstanceState) {
21         super.onCreate(savedInstanceState);
22         setContentView(R.layout.activity_main);
23 
24         webView = (WebView) findViewById( R.id.webview );
25 
26 
27         if ( webViewHeaderValue != "" ){
28             Map<String, String > map = new HashMap<String, String>() ;
29             map.put( webViewHeaderKey , webViewHeaderValue ) ;
30 
31             webView.loadUrl( url  , map ) ;
32         }else {
33             webView.loadUrl( url ) ;
34         }
35 
36     }
37 }

相关文章:

  • 2021-04-17
  • 2019-08-02
  • 2021-07-05
  • 2021-11-28
  • 2021-07-17
  • 2021-09-20
  • 2021-11-28
  • 2021-06-27
猜你喜欢
  • 2021-10-12
  • 2021-11-28
  • 2021-11-02
  • 2021-12-24
  • 2021-10-13
  • 2021-11-30
  • 2021-11-29
  • 2021-11-28
相关资源
相似解决方案