Loading URL in WebView and URL having MenuItem but click on menu its not being Populated

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Loading URL in WebView and URL having MenuItem but click on menu its not being Populated

PritisMD
This post has NOT been accepted by the mailing list yet.
In axml file I added an WebView from my Main activity I am trying to launch the webview with shpecific URL and this Url Contails Menu item screen shot as below



but when I click on the MenuItem that shown in image will not work. My application (android app) is having some buttons, when I clicked on button it loads the URL(any url) in WebView on click event of button, its work to launch URL. but URL has MenuItem and I click on that Menu that menu option not displayed. But other option like search is work.



here I click on search it display popup for Search but sililar like for Menu it wont.

here is code

MainActivity.cs

 FindViewById<Button>(Resource.Id.btnWebsite).Click += (s, e) =>
        {
            var webViewActivity = new Intent(this, typeof(WebViewActivity));
            webViewActivity.PutExtra("MyData", "http://www.SITE URL.com");
            StartActivity(webViewActivity);
        };
WebViewActivity.cs

  public class WebViewActivity : Activity
    {
        WebView web_view;
        MyWebViewClient myWebViewClient;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layout1);
            myWebViewClient = new MyWebViewClient();

            web_view = FindViewById<WebView>(Resource.Id.webview);
            string text = Intent.GetStringExtra("MyData");
            // Create your application here
            web_view.Settings.JavaScriptEnabled = true;
            web_view.SetWebViewClient(myWebViewClient);
            web_view.LoadUrl(text);

        }
    }
    public class MyWebViewClient : WebViewClient
    {
        public override bool ShouldOverrideUrlLoading(WebView view, string url)
        {
            view.LoadUrl(url);
            return true;
        }

        public override void OnPageStarted(WebView view, string url, Android.Graphics.Bitmap favicon)
        {
            base.OnPageStarted(view, url, favicon);
        }

        public override void OnPageFinished(WebView view, string url)
        {
            base.OnPageFinished(view, url);
        }

        public override void OnReceivedError(WebView view, ClientError errorCode, string description, string failingUrl)
        {
            base.OnReceivedError(view, errorCode, description, failingUrl);
        }
    }
layout1.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="#0B95BA"
    android:minWidth="25px"
    android:minHeight="25px">
    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>