Navigation Marker - android

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"));

Related

Custom POI data into the Google Map

I have created a app and have implemented Google maps.
Am I allowed to incorporate my own custom POI data into the Google Map developing a Android app?
Yes, you can add markers to the map like in the code below. You can find a full tutorial here.
#Override
public void onMapReady(GoogleMap map) {
map.addMarker(new MarkerOptions()
.position(new LatLng(10, 10))
.title("Hello world"));
}

Cannot resolve symbol ItemizedOverlay

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.

Android popup like IOS

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

Google Maps remove marker route context menu

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
}

Adding a marker to a Google maps fragment

I have added a map fragment to my application and added the following code to place a marker on the fragment.But I'm getting errors in the code snippet.I have included all relevant imports.
The errors are compile time and are as follows:
1.MapFragment cannot be resolved to a type.
2.GoogleMap cannot be resolved to a type.
3.LatLng cannot be resolved to a type.
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.addMarker(new MarkerOptions()
.position(new LatLng(0, 0))
.title("Hello world"));
Anyone have any ideas where the error is in the snippet? Thanks
I think you should check two things first
Is the Google Play Service project or library added to your project ? If not, check this link http://developer.android.com/google/play-services/setup.html
If you compile for android version < 11, you need to use supportFragmentManager instead of the normal FragmentManager :
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
In the last case, you also need to update the class used in your XML to class="com.google.android.gms.maps.SupportMapFragment"

Categories

Resources