Example usage for org.apache.cordova CordovaWebView loadUrl

List of usage examples for org.apache.cordova CordovaWebView loadUrl

Introduction

In this page you can find the example usage for org.apache.cordova CordovaWebView loadUrl.

Prototype

void loadUrl(String url);

Source Link

Usage

From source file:com.addlive.tutorials.MainActivity.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Phonegap webview
    CordovaWebView cordovaWV = (CordovaWebView) findViewById(R.id.cordovaWebView);
    cordovaWV.loadUrl("file:///android_asset/www/Tutorial6.html");

    // To avoid local surface view black flashes. Explanation here:
    // http://stackoverflow.com/questions/8772862/surfaceview-flashes-black-on-load
    SurfaceView _local = new SurfaceView(MainActivity.this);
    RelativeLayout.LayoutParams surfaceParams = new RelativeLayout.LayoutParams(0, 0);
    ((ViewGroup) cordovaWV.getParent()).addView(_local, surfaceParams);
}

From source file:idv.funnybrain.redmind.MainActivity.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Set by <content src="index.html" /> in config.xml
    //        loadUrl(launchUrl);
    setContentView(R.layout.main);//  ww w  .j a  v  a  2 s.  c om

    CordovaWebView cwv = (CordovaWebView) findViewById(R.id.webView);
    Config.init(this);
    cwv.loadUrl("http://zhenhai.no-ip.org");
}

From source file:me.ncu.quickgap.QuickGap.java

License:Apache License

private void createCordovaWebview(String id, String url) {

    CordovaWebView webview = new CordovaWebView(this);

    CordovaWebViewClient webviewc = null;

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webviewc = new CordovaWebViewClient(this, webview);
    } else {//  w  ww.  java  2  s.co  m
        webviewc = new IceCreamCordovaWebViewClient(this, webview);
    }

    webview.setWebViewClient(webviewc);
    webviewc.setWebView(webview);

    CordovaChromeClient webviewcc = null;
    webviewcc = new CordovaChromeClient(this, webview);
    webview.setWebChromeClient(webviewcc);
    webviewcc.setWebView(webview);

    RelativeLayout.LayoutParams webviewLayout = new RelativeLayout.LayoutParams(display.getWidth(),
            display.getHeight());
    webviewLayout.alignWithParent = true;
    webview.setLayoutParams(webviewLayout);

    //this.root.addView(webview);
    webview.loadUrl(url);
    webview.addJavascriptInterface(new QGJavaScriptInterface(this), "quickgap");

    webviewPool.put(id, webview);

    final String viewId = id;

    Animation animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left);
    animation.setFillAfter(true);
    animation.setFillEnabled(true);
    animation.setDuration(animationDuration);
    animation.setAnimationListener(new AnimationListener() {

        public void onAnimationEnd(Animation animation) {

        }

        public void onAnimationRepeat(Animation animation) {

        }

        public void onAnimationStart(Animation animation) {

        }

    });

    webviewPool.get(viewId).startAnimation(animation);
}