Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I created a little hack for this. :)</p> <p>strings.xml</p> <pre><code>&lt;string name="html_streetview"&gt; &lt;![CDATA[ &lt;html&gt; &lt;head&gt; &lt;script src="http://maps.google.com/maps/api/js?v=3&amp;amp;sensor=false" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; Android.echo(); var testPoint = new google.maps.LatLng(%1$s, %2$s,true); var svClient = new google.maps.StreetViewService(); svClient.getPanoramaByLocation(testPoint, 50,function (panoramaData, status) { if (status == google.maps.StreetViewStatus.OK) { Android.hasStreetview(); } else { Android.hasNotStreetview(); } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; ]]&gt; &lt;/string&gt; </code></pre> <p>now add a button for streetview on the activity and put this following code into the onclick method:</p> <pre><code> if (webView == null) { webView = new WebView(this); webView.setVisibility(View.INVISIBLE); webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(new JavascriptCheck(this), "Android"); webView.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(this, "Streetview loading", Toast.LENGTH_SHORT).show(); super.onReceivedError(view, errorCode, description, failingUrl); } }); } Toast.makeText(this, "Streetview loading", Toast.LENGTH_SHORT).show(); webView.loadDataWithBaseURL(baseurl, getString(R.string.html_streetview, latitude, longitude), "text/html", "UTF-8", baseurl); </code></pre> <p>And now the inner Class of the activity:</p> <pre><code>public class JavascriptCheck { private final Context context; public JavascriptCheck(Context context) { this.context = context; } public void echo() { Log.d("JavascriptChecker", "javascript called"); } public void hasStreetview() { pushStreetviewState(true); } public void hasNotStreetview() { pushStreetviewState(false); } private void pushStreetviewState(final boolean hasStreetview) { Log.d("JavascriptChecker", hasStreetview); // TODO do your stuff needed here } } </code></pre> <p>this a a rather bad workaround but probably can help. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload