After I use webview - How to get back to the page

edcal2edcal2 Member ✭✭✭

I am using webview to view a web page and do some processing. How do I get back to the page that displayed the web page?


  • JarvanJarvan Member, Xamarin Team Xamurai

    The webview is just displayed on the page. You can set the webView's visibility to gone to hide the webView in a Button's click event.

    public class MainActivity : AppCompatActivity
        WebView webView;
        protected override void OnCreate(Bundle savedInstanceState)
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            webView = FindViewById<WebView>(Resource.Id.webview_);
            webView.Settings.JavaScriptEnabled = true;
            webView.SetWebViewClient(new HelloWebViewClient());
            FindViewById<Button>(Resource.Id.button1).Click += delegate
                webView.Visibility = webView.Visibility == ViewStates.Visible ? ViewStates.Gone : ViewStates.Visible;

    Or start a new activity to display the WebView. Go back to the previous activity via back button.

Sign In or Register to comment.