Issue
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.
Solution
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)));
Answered By - Gowthaman M
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.