Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            // Get our button from the layout resource,
            // and attach an event to it



            var chrome = new FileChooserWebChromeClient((uploadMsg, acceptType, capture) => {
                mUploadMessage = uploadMsg;
                var i          = new Intent(Intent.ActionGetContent);
                i.AddCategory(Intent.CategoryOpenable);
                i.SetType("image/*");
                StartActivityForResult(Intent.CreateChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
            });

            var    webview = this.FindViewById <WebView> (Resource.Id.webView1);
            string fileUrl = "file:///android_asset/HTML5_Demo.html";

            webview.Settings.JavaScriptEnabled = true;
            webview.AddJavascriptInterface(new MyJSInterface(this), "wx");
            webview.SetWebViewClient(new WebViewClient());
            webview.SetWebChromeClient(chrome);
            webview.Settings.JavaScriptEnabled = true;
            webview.LoadUrl("https://hostcs.kku.ac.th/2561/583021143-5/esaan/index.php");
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);
            };

            var chrome = new FileChooserWebChromeClient((uploadMsg, acceptType, capture) => {
                mUploadMessage = uploadMsg;
                var i          = new Intent(Intent.ActionGetContent);
                i.AddCategory(Intent.CategoryOpenable);
                i.SetType("image/*");
                StartActivityForResult(Intent.CreateChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
            });

            var webview = this.FindViewById <WebView> (Resource.Id.webView1);

            webview.SetWebViewClient(new WebViewClient());
            webview.SetWebChromeClient(chrome);
            webview.Settings.JavaScriptEnabled = true;
            webview.LoadUrl("http://www.script-tutorials.com/demos/199/index.html");
        }