GoogleMaps not loading properly - android

I want to change my GoogleMaps view between StreetView and Satellite via menubutton.
The code I have used is:
case R.id.item_satellite_view:
mapView.setStreetView(false);
mapView.setSatellite(true);
mapView.invalidate();
return true;
case R.id.item_street_view:
mapView.setSatellite(false);
mapView.setStreetView(true);
mapView.invalidate();
return true;
The problem I am getting is the map only shows blank squares with X in it.
Can anyone please help?

You need to ask for a Google Maps API key. See my own question time ago

Related

How to handle the click event on current location icon on google maps in android

I am getting an icon shown in the figure on the google Maps. Now i have the confusion how to show the current location on the maps with marker whenever a user clicks on the current Location icon the google maps.
After placing this code i got the icon on the google maps
Map.setMyLocationEnabled(true);
On the top-right google map is showing the current location icon, Now my confusion is how to handle this event to show my current location on the google maps.
use setOnMyLocationButtonClickListener() and override
#Override
public boolean onMyLocationButtonClick(){
return false;
}
returning false does the default behavior

How to detect a longpress guesture with Google Map V2?

I am an android fresh man and developing a small app with Google Map V2.
I want to get the WGS84 (i.e. LatLng)position when longpress on the MAP.
Several methods are tried as the answers in other topic but the longpress guesture still could not be detected.
Can anyone help on this to provide some sample code for me?
Have you tried this?
mMap.setOnMapLongClickListener(new OnMapLongClickListener() {
#Override
public void onMapLongClick(final LatLng point) {
}
});

osmdroid trigger tap on mapview

I am develpoing a map application with OpenStreetMaps. I am trying to generate a tap on a point from a org.osmdroid.views.MapView like can be done in Google Maps for Android:
HelloItemizedOverlay o = new HelloItemizedOverlay(drawable,getApplicationContext());
o.onTap(GeoPoint p, MapView mapView);
So far I haven't found an equivalent solution.
I realized that what I wanted to do was triggering a call to my implementation of onItemSingleTapUp on a specified item, so i did it:
this.onItemSingleTapUp(0, itemizedoverlay.getItem(0));

Android: MapOverlay - Current location

I am currently creating an Android application, that shows the user its current location on Google Maps. I currently have it working so brings up the location, zoomed in.
However, I want the location to be pin-pointed. I have attempted to try and follow the HelloMapView tutorial, but have been having difficulty. How do I modify what the tutorial is saying, to make the Overlay, show the current location?
Also, I have been getting an error, with the getDrawable part of the following:
Drawable drawable = ((Object) this.getResources()).getDrawable(R.drawable.androidmarker);
ItemizedOverlay itemizedoverlay = new ItemizedOverlay(drawable, this);
Also, whereabouts do I paste this:
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
Thank you.

Google maps: change from satellite view to street view

I want to to change the google map view from one state to another. Currently the view is satellite view, now I want to change it to street view. I have written as below but it's not changing the view. How do I change the view at run-time?
mapView.setStreetView(true);
After that put this line and let me know what happen,
mapView.invalidate();
In your code you have to do something like,
mapView.setStreetView(true);
mapView.setSatellite(false);
mapView.invalidate();
Uninstall the project from the emulator and again run it.It hope it will work.
As the MapView reference shows, setStreetView does not change the map to street view - it only toggles showing the blue streaks indicating whether street view is available or not, on the map position you're currently looking at. I would guess that the easiest way to start street view is to start google's own street view app via StartActivity.
mapView.setStreetView(true);
Is depreciated.
try {
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.streetview:cbll="+my_lat+","+my_lng+"&cbp=1,99.56,,1,-5.27&mz=21"));
streetView.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(streetView);
} catch ( Exception ex ) {
Toast.makeText(getBaseContext(), "Could not launch Goole Street View. Are you sure it's installed? Launching market...", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=com.google.android.street"));
startActivity(intent);
}
Without the try/catch your app will crash if street view isn't installed.
See this possible duplicate
mapView.setStreetView(true);
mapView.setSatellite(false);
mapView.invalidate();

Categories

Resources