I need to implement popup dialog like in iOS, and show above some view (map point in this case), but don't know how to implement it. A screenshot is attached. Will be glad to read any proposals.
Looks like you are adding it inside a mapview as from above image:
use this and change the features according to your requirement
static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298);
Marker melbourne = mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("Melbourne")
.snippet("Population: 4,137,400"));
Refer this link: link
Use this example
Just call this when you want to open that dialog
MyCustomDialog dialog = new MyCustomDialog(buttonView);
dialog.show();
Related
i got this error when i extends ItemizedOverlay on Activity. How can i resolve this error ? can any one help me out here.
ItemizedOverlay is no longer available in Google Maps v2.
If you would like to display marker on a map you can user Marker class. You can create Marker object using MarkerOptions.
I'm attaching the simplest example:
#Override
public void onMapReady(GoogleMap map) {
map.addMarker(new MarkerOptions()
.position(new LatLng(52.2330653, 20.9211106))
.title("Warsaw"));
}
In addition I recommend reading Google Maps Android API and Markers section.
You can make a marker draggable using:
MarkerOptions.draggable(boolean)
Marker.setDraggable(boolean)
You can also attach marker drag listener, you can find more here.
I have built a music app and now I am trying to build a mapping feature more like Shazam's or Instagrams as follows:
Where initially, I am to drop a general marker on several points without actually showing all the activity in that location. Then on tapping that marker, the map will zoom in and other markers that are more specific will show, and so on..
Is there a tutorial available that I can follow the to achieve this effect in Android?
I have just found out that Google has a utility library that provides for marker clustering. The documentation can be found here https://developers.google.com/maps/documentation/android-api/utility/marker-clustering
You can create a method to add custom markers using this function:
private void drawCustomMarker(LatLng point) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(point);
markerOptions.title("SMS");
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.sms));
mMap.addMarker(markerOptions);
}
You can pass LatLng object where you want to drop the marker. I have used it in map click listener:
mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
#Override
public void onMapLongClick(LatLng newlatLng) {
drawCustomMarker(newlatLng);
}
});
Hope it will help you..!
I started a new project with the Google Maps template of Android Studio and just added a marker to the map.
LatLng location = new LatLng(lat, lng);
Marker marker = mMap.addMarker(new MarkerOptions()
.position(location)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));
When I click the Marker there comes a little menu with a Google Maps icon on the bottom right corner:
How can I get rid of this thing? I couldn't find anything I even don't know how to call it but I really need to get rid of it.
You need to call setMapToolbarEnabled method of UiSettings
Like this:
#Override
public void onMapReady(GoogleMap googleMap) {
googleMap.getUiSettings().setMapToolbarEnabled(false);
// Do other staff
}
I'm making a Navigation based application for Android using API. I have successfully added Google Maps to my app. But now I want to add navigation marker (arrow like symbol) same as we see in official Navigation app of Google. I searched allot but didnt found anything. So can anyone help me out?
There is a link to a good read about this.
Try this:
GoogleMap map;
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
map.addMarker(new MarkerOptions()
.position(new LatLng(0, 0))
.title("Hello world"));
I am using Xamarin and am using the SimpleMapDemo and I have a question about setting a MarkerOptions object to have a different icon.
Here is my current code:
marker1.Icon(SetFeatureDrawable('Icon.png'));
This above code is not working.
May I please have some help to set the icon to be the icon that is in the Drawable folder that has the name of 'Icon.png'?
Thanks in advance
EDIT
Here is my code:
marker1.Icon(BitmapDescriptorFactory.FromResource(Resource.Drawable.monkey));
This is the error I am getting:
Non-invocable member 'Android.Gms.Maps.Model.MarkerOptions.Icon' cannot be used like a method
Here is my code to try and set the icon:
marker1.Icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.monkey);
This is the error I am getting:
CS0200: Property or indexer 'Android.Gms.Maps.Model.MarkerOptions.Icon' cannot be assigned to -- it is read only (CS0200)
Try this code instead:
marker1.InvokeIcon(SetFeatureDrawable('Icon.png'));
In general, Xamarin tries to bind the Java setter/getters to properties. In this case, although MarkerOption.icon looks like a property to C# eyes, it is in fact a Java method. In this case the binding has "translated" the property-like Java method to MarkerOption.InvokeIcon in an attempt to conform with C# design guidelines.
Try in this way:
double latitude = 0.0;
double longitude = 0.0;
MarkerOptions mapMarker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Your title will be here");
mapMarker .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon)));
mapView.addMarker(mapMarker );
Try this one, using this i can show custom icon from drawable resource as marker in map
MarkerOptions markerOptions = new MarkerOptions();
// Setting position on the MarkerOptions
markerOptions.SetPosition(lt);
markerOptions.InvokeIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));