当前位置: 首页>>代码示例>>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;未经允许,请勿转载。