Reputation: 338
This is my code and it compiles correctly, but when I want to run the app, it shows
Unfortunately, app has stopped
This is my code:
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
LatLng pp = new LatLng( 12,12 );
MarkerOptions option = new MarkerOptions();
option.position(pp)
.title( "hi " )
.snippet("for test");
option.icon(BitmapDescriptorFactory.fromResource(R.drawable.about));
map.addMarker( option );
map.moveCamera( CameraUpdateFactory.newLatLng( pp ) );
When I remove this line:
option.icon(BitmapDescriptorFactory.fromResource(R.drawable.about));
it works correctly. I need to change default marker but I can't.
Upvotes: 0
Views: 300
Reputation: 8272
Change default marker with color in google map, please try below like this:
googleMap.addMarker(new MarkerOptions()
.position(BROOKLYN_BRIDGE)
.title("First Pit Stop")
.icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
Upvotes: 2