當前位置: 首頁>>代碼示例>>Java>>正文


Java WebView.loadUrl方法代碼示例

本文整理匯總了Java中android.webkit.WebView.loadUrl方法的典型用法代碼示例。如果您正苦於以下問題:Java WebView.loadUrl方法的具體用法?Java WebView.loadUrl怎麽用?Java WebView.loadUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.loadUrl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPostExecute

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Boolean doit) {
    if (!doit.booleanValue() || isCancelled()) {
        if(DBG) Log.d(TAG, "WebViewDelayedInitTask canceled");
        return;
    }
    if(DBG) Log.d(TAG, "starting creation of WebView in " + mParent);

    Context c = mParent.getContext();
    View content = LayoutInflater.from(c).inflate(R.layout.leanback_weblink_cardview_content, mParent, false);
    mProgress = content.findViewById(R.id.progress);
    mWebView = (WebView)content.findViewById(R.id.webview);
    initWebView();

    mParent.removeView(mPlaceholder);
    mParent.addView(content);

    // Load the url if it has been setup already
    if (mUrl!=null) {
        mWebView.loadUrl(mUrl);
    }
    mWebViewDelayedInitTask = null; // way to remember it is over
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:24,代碼來源:WebPageLinkPresenter.java

示例2: injectJsFile

import android.webkit.WebView; //導入方法依賴的package包/類
private void injectJsFile(WebView view) {
//        String js = FileUtils.readFromFile("web/inject.js");
//        Log.d(TAG, "injectJsFile: \n js = " + js);
        view.loadUrl("javascript:" + "(function imgOnClick(){\n" +
                "    var imgs = document.getElementsByTagName(\"img\");\n" +
                "    for(var i = 0; i < imgs.length;i++){\n" +
                "            imgs[i].onclick = function(){\n" +
                "                jk.showBigImage(this.src);\n" +
                "            };\n" +
                "    }\n" +
                "})()");
    }
 
開發者ID:jiangkang,項目名稱:KTools,代碼行數:13,代碼來源:KWebViewClient.java

示例3: onPageFinished

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    view.loadUrl("javascript:(function () {" +
            "    var objs = document.getElementsByTagName(\"img\");" +
            "    for (var i = 0; i < objs.length; i++) {" +
            "        objs[i].onclick = function () {" +
            "            window.imgClickListener.openImage(this.src);" +
            "        }" +
            "    }" +
            "})()");
}
 
開發者ID:shenhuanet,項目名稱:ZhidaoDaily-android,代碼行數:13,代碼來源:BaseWebViewClient.java

示例4: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
private void setUpWebView() {
    mWebView = new WebView(getContext());

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new TwitterWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");

    mContent.addView(mWebView);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:15,代碼來源:TwitterDialog.java

示例5: onCreateView

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //Get the WebView element:
    LayoutInflater lf = getActivity().getLayoutInflater();
    rootView =  lf.inflate(R.layout.fragment_about, container, false);
    WebView webView = (WebView) rootView.findViewById(R.id.webView);
    //Load the HTML file in the WebView:
    webView.loadUrl("file:///android_asset/about.html");
    return rootView;
}
 
開發者ID:brianjaustin,項目名稱:permitlog-android,代碼行數:11,代碼來源:AboutFragment.java

示例6: shouldOverrideUrlLoading

import android.webkit.WebView; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.N)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {

    if (mCustomWebViewClient!=null){
        boolean ret =  mCustomWebViewClient.shouldOverrideUrlLoading(view,request);
        if (ret){
            return true;
        }
    }
    view.loadUrl(request.getUrl().toString());
    return true;
}
 
開發者ID:yale8848,項目名稱:CacheWebView,代碼行數:14,代碼來源:CacheWebViewClient.java

示例7: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    webView = new WebView(this);
    setContentView(webView);
    webView.loadUrl("file:///android_asset/scheme.html");
}
 
開發者ID:chenenyu,項目名稱:Router,代碼行數:9,代碼來源:WebActivity.java

示例8: b

import android.webkit.WebView; //導入方法依賴的package包/類
private void b(String str) {
    WebView webView = (WebView) this.a.get();
    if (webView != null) {
        StringBuffer stringBuffer = new StringBuffer("javascript:");
        stringBuffer.append("if(!!").append(this.e).append("){");
        stringBuffer.append(this.e);
        stringBuffer.append("(");
        stringBuffer.append(str);
        stringBuffer.append(")}");
        String stringBuffer2 = stringBuffer.toString();
        f.b(f.d, "-->callback, callback: " + stringBuffer2);
        webView.loadUrl(stringBuffer2);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:c.java

示例9: b

import android.webkit.WebView; //導入方法依賴的package包/類
private void b(String str) {
    WebView webView = (WebView) this.a.get();
    if (webView != null) {
        StringBuffer stringBuffer = new StringBuffer("javascript:");
        stringBuffer.append("if(!!").append(this.e).append("){");
        stringBuffer.append(this.e);
        stringBuffer.append(SocializeConstants.OP_OPEN_PAREN);
        stringBuffer.append(str);
        stringBuffer.append(")}");
        String stringBuffer2 = stringBuffer.toString();
        f.b(f.d, "-->callback, callback: " + stringBuffer2);
        webView.loadUrl(stringBuffer2);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:15,代碼來源:c.java

示例10: a

import android.webkit.WebView; //導入方法依賴的package包/類
public void a() {
    WebView webView = (WebView) this.a.get();
    if (webView != null) {
        webView.loadUrl("javascript:window.JsBridge&&JsBridge.callback(" + this.b + "," +
                "{'r':1,'result':'no such method'})");
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:a.java

示例11: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web_view);
    Log.d(this.getClass().getSimpleName(), "onCreate: ");

    webView = new WebView(WebViewActivity.this);
    webView.getSettings().getJavaScriptEnabled();
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl(OTHERS_GAMES_URL);

    setContentView(webView);

}
 
開發者ID:AythaE,項目名稱:ESDLA-Quiz,代碼行數:15,代碼來源:WebViewActivity.java

示例12: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mWebView = new WebView(this);
    mWebView.setScrollContainer(false);
    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    setContentView(mWebView, layoutParams);

    Bundle args = getIntent().getExtras();
    String url = args.getString(ARG_URL);

    mWebView.setWebViewClient(new WebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
    }
    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.loadUrl(url);
}
 
開發者ID:ansarisufiyan777,項目名稱:Show_Chat,代碼行數:28,代碼來源:VideoActivity.java

示例13: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);


    WebView webview = (WebView)findViewById(R.id.WebView);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl("https://github.com/qoli/MiHomePlus/blob/master/README.md");

}
 
開發者ID:qoli,項目名稱:MiHomePlus,代碼行數:14,代碼來源:Help.java

示例14: a

import android.webkit.WebView; //導入方法依賴的package包/類
public void a(String str) {
    WebView webView = (WebView) this.a.get();
    if (webView != null) {
        webView.loadUrl("javascript:" + str);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:7,代碼來源:a.java

示例15: updateNumsService

import android.webkit.WebView; //導入方法依賴的package包/類
public static void updateNumsService(WebView view) {
    view.loadUrl("javascript:(function()%7Bfunction%20n_s()%7Bandroid.getNums(document.querySelector(%22%23notifications_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23messages_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML%2Cdocument.querySelector(%22%23requests_jewel%20%3E%20a%20%3E%20div%20%3E%20span%5Bdata-sigil%3Dcount%5D%22).innerHTML)%2CsetTimeout(n_s%2C" + BADGE_UPDATE_INTERVAL + ")%7Dtry%7Bn_s()%7Dcatch(_)%7B%7D%7D)()");
}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:4,代碼來源:JavaScriptHelpers.java


注:本文中的android.webkit.WebView.loadUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。