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();
}
}
});
}
}
});