title: Check if google streetview location exists or not to hide a view
body: <p>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.</p>
  
  <p>What I have done so far in My StreetViewActivity:</p>
  
  <pre><code>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 &amp;&amp; loc.links != null) {
                                      //panorama.setPosition(LOCATION);
                                  }else{
                                      Toast.makeText(PropertyStreetViewActivity.this, "No Street View Available For This Location", Toast.LENGTH_LONG)
                                              .show();
                                      finish();
                                  }
                              }
                          });
  
                      }
                  }
              });
  </code></pre>
  
  <p>And a Screenshot of my LocationActivity:
  <a href="https://i.stack.imgur.com/7kScU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7kScU.jpg" alt="Map With StreetView Button"></a></p>