Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (55 sloc) 2.06 KB
using Android.App;
using Android.Views.InputMethods;
using Android.Webkit;
using Android.Widget;
using Android.OS;
using SysTrace = System.Diagnostics.Trace;
namespace CDS_Aladin
[Activity(Label = "AladinLiteDemo", MainLauncher = true, Icon = "@mipmap/logo")]
public class MainActivity : Activity
readonly string template = @"<html>
<meta charset='UTF-8'>
<link rel='stylesheet' href='' >
<script type='text/javascript' src='' charset='utf-8'></script>
<script type='text/javascript' src='' charset='utf-8'></script>
<div id='aladin-lite-div' style='width:auto;'>
<script type='text/javascript'>var aladin = A.aladin('#aladin-lite-div', {fov:0.5, target: '[target]'});</script>
protected override void OnCreate(Bundle savedInstanceState)
var imm = (InputMethodManager)GetSystemService(InputMethodService);
// Set our view from the "main" layout resource
var target = FindViewById<EditText>(;
var webView = FindViewById<WebView>(Resource.Id.webView);
webView.Settings.JavaScriptEnabled = true;
webView.SetWebViewClient(new MyWebViewClient());
var navigate = FindViewById<Button>(Resource.Id.navigate);
navigate.Click += (sender, e) =>
var obj = target.Text;
if (string.IsNullOrEmpty(obj)) return;
imm.HideSoftInputFromWindow(target.WindowToken, HideSoftInputFlags.None);
var page = template.Replace("[target]", obj);
SysTrace.WriteLine("Page source: " + page);
webView.LoadData(page, "text/html", "UTF-8");
internal class MyWebViewClient : WebViewClient
public override bool ShouldOverrideUrlLoading(WebView webView, string url)
return false;