开发者

Android: using StreetView without starting an intent

开发者 https://www.devze.com 2023-01-19 01:21 出处:网络
I\'m working on a simple android app in which I want to, once the user has clicked a button on the main screen, display the streetview of known coordinates.

I'm working on a simple android app in which I want to, once the user has clicked a button on the main screen, display the streetview of known coordinates.

I can create display a map like so:

    mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    mapController = mapView.getContro开发者_运维技巧ller();
    mapController.setZoom(6); // Zoom 1 is world view

    GeoPoint point = new GeoPoint(...);
    mapController.setCenter(point);
    mapController.animateTo(point);

Through this method, I could easily add my own buttons, overlays, etc over the map which my user could press to do certain actions based on their current location on the map.

I want to, instead of displaying a map, display a streetview with my own custom buttons displayed on top of it (along with the standard google ones). The only way I've found of displaying a streetview is as follows:

String uri = "google.streetview:cbll="+ latitude+","+longitude+"&cbp=1,99.56,,1,-5.27&mz=21";
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
startActivity(streetView);

Is there any way to start a streetview in a way through which it could be embedded into my application so that I could put buttons on top of the streetview which would allow my user to do certain actions based on their current location?

Many thanks in advance,

r3mo


Is there any way to start a streetview in a way through which it could be embedded into my application so that I could put buttons on top of the streetview which would allow my user to do certain actions based on their current location?

Not that I am aware of. MapView supports isStreetView() and setStreetView(), but I think that just draws the blue lines indicating where StreetView data is available.

0

精彩评论

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

关注公众号