开发者

Loading a Maps API site in a Native Android Application

开发者 https://www.devze.com 2022-12-21 06:17 出处:网络
I\'m trying to follow the example from google: http://code.google.com/apis/maps/articles/android_v3.html

I'm trying to follow the example from google:

http://code.google.com/apis/maps/articles/android_v3.html

Using the example files from their SVN repo:

(http)gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/

But although it seems to compile and export it fails; can someone sanity check that its not just me this fails for a开发者_运维问答nd any hints as to if its a quick thing to fix, I've been prodding it with try/catch for the last 2 hours to no avail.

Thanks :o)

Forgot to add It Compiles and Uploads to the emulator (and to my phone) but running it just results in

The Application WebMapActivity (process com.google.android.examples.webmap) 
has stopped unexpectedly. Please try again. [Force Close]


Filtered it down to

private void setupWebView() {
        /*
            final String centerURL = "javascript:centerAt("
                    + mostRecentLocation.getLatitude() + ","
                    + mostRecentLocation.getLongitude() + ")";
            webView = (WebView) findViewById(R.id.webview);
            webView.getSettings().setJavaScriptEnabled(true);
            // Wait for the page to load then send the location information
            webView.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    webView.loadUrl(centerURL);
                }

            });*/
            webView = (WebView) findViewById(R.id.webview);
            webView.loadUrl(MAP_URL);
    }

Bit easier to filter out the actual issue when you know which bit doesnt work thanks to CommonsWare for the great book, poking through that and test-code that ACTUALLY WORKS made it a bit easier to work out what was going on. And thanks for the debug info :o)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号