7 package com.google.appinventor.components.runtime;
9 import android.content.Intent;
10 import android.net.Uri;
11 import android.os.Bundle;
12 import android.util.Log;
13 import android.webkit.WebView;
14 import android.webkit.WebViewClient;
34 public void onCreate(Bundle savedInstanceState) {
37 super.onCreate(savedInstanceState);
38 webview =
new WebView(
this);
39 webview.getSettings().setJavaScriptEnabled(
true);
40 webview.setWebViewClient(
new WebViewClient() {
42 public boolean shouldOverrideUrlLoading(WebView view, String url) {
43 Log.i(
"WebView",
"Handling url " + url);
44 Uri uri = Uri.parse(url);
45 String scheme = uri.getScheme();
47 Intent resultIntent =
new Intent();
48 resultIntent.setData(uri);
49 setResult(RESULT_OK, resultIntent);
59 Intent uriIntent = getIntent();
60 if (uriIntent !=
null && uriIntent.getData() !=
null) {
61 Uri uri = uriIntent.getData();
62 String scheme = uri.getScheme();
63 String host = uri.getHost();
64 Log.i(
"WebView",
"Got intent with URI: " + uri +
", scheme="
65 + scheme +
", host=" + host);
66 webview.loadUrl(uri.toString());