0

I am currently working on an android application which requires me to use street view in my app. I have made a StreetViewActivity to show the street view. But before that activity, I have another activity called Location Activity that has a button that takes the user to the StreetViewActivity. Now my question is how can I check if the latitude and longitude that is provided don't have a streetview then it should hide the button that would prevent the user from going to the StreetViewActivity? I can check if the lat lng exists in my StreetViewActivity but I need to check in the previous activity.

What I have done so far in My StreetViewActivity:

LOCATION = new LatLng(Latitude, Longitude);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment =
            (SupportStreetViewPanoramaFragment)
                    getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(
            new OnStreetViewPanoramaReadyCallback() {
                @Override
                public void onStreetViewPanoramaReady(final StreetViewPanorama panorama) {

                    if (savedInstanceState == null) {

                        panorama.setPosition(LOCATION);
                        panorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
                            @Override
                            public void onStreetViewPanoramaChange(StreetViewPanoramaLocation loc) {
                                if (loc != null && loc.links != null) {
                                    //panorama.setPosition(LOCATION);
                                }else{
                                    Toast.makeText(PropertyStreetViewActivity.this, "No Street View Available For This Location", Toast.LENGTH_LONG)
                                            .show();
                                    finish();
                                }
                            }
                        });

                    }
                }
            });

And a Screenshot of my LocationActivity: Map With StreetView Button

Shafayat Mamun
  • 439
  • 1
  • 6
  • 22

1 Answers1

0

How to check if latitude and longitude that is provided don't have a streetview was already solved in How to check if Google Street View available and display message?

By default, Street View is enabled on a map and a Street View Pegman control appears integrated within the navigation (zoom and pan) controls. You may hide this control within the map's MapOptions by setting streetViewControl to false.

streetViewControl: false
Community
  • 1
  • 1
Teyam
  • 7,686
  • 3
  • 15
  • 22
  • This is for android BTW. – Shafayat Mamun Apr 07 '16 at 09:02
  • For Android, [Google Maps Android API - Customize the user-controlled functionality](https://developers.google.com/maps/documentation/android-api/streetview#customize_the_user-controlled_functionality) can help. :) – Teyam Apr 21 '16 at 05:48