So I have made a web based app in VS2016 using Xamarin.Android and when i load the app. Can someone tell me where i have messed up here? The aim is to open the web page in the app and not go to an external browser.
MainActivity.cs
using Android.App;
using Android.Widget;
using Android.OS;
using Android.Webkit;
namespace ArasiaWebBasedAppFinal
{
[Activity(Label = "Arasia", MainLauncher = true, Theme = "@android:style/Theme.NoTitleBar")]
public class MainActivity : Activity
{
WebView web_view;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
web_view.SetWebViewClient (new ArasiaClient());
SetContentView(Resource.Layout.Main);
web_view = FindViewById<WebView> (Resource.Id.webview);
web_view.Settings.JavaScriptEnabled = true;
web_view.LoadUrl ("http://www.google.com");
}
}
public class ArasiaClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading (WebView view, string url)
{
view.LoadUrl (url);
return true;
}
}
}
Main.axml
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />