Forum Xamarin Xamarin.Android

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.

  • edcaledcal Member ✭✭✭

    I may not be asking the questions right. The android emulator does not have a previous page like a regular web page.
    When I am on a android page and I use WebView to display a web page how do I get back to the android page.

Sign In or Register to comment.