Showing posts with label googlemaps. Show all posts
Showing posts with label googlemaps. Show all posts

Wednesday, April 10, 2013

Add Marker to Google Map

To detect a long map click by the user, so add a new Marker, we need to implement OnMapLongClickListener Interface.

Then we set our map to listen for any calls when its long pressed :    mMap.setOnMapLongClickListener(this);

And now in our code we can add a new Marker every time the user long clicks the map :

mMap.addMarker(new MarkerOptions().position(point));

Monday, April 8, 2013

Detect user click on Map

To detect click on GoogleMap we implement OnMapClickListener Interface.
We add to our GoogleMap setOnMapClickListener . This sets a callback to the Interface when the map is clicked

Then we need to override the onMapClick(LatLng point) 


@Override 
public void onMapClick(LatLng point) { mMap.animateCamera(CameraUpdateFactory.newLatLng(point)); }


We are using CameraUpdateFactory to get a new CameraUpdate Object ( an object to modify a map's camera ) and animate to the new point with animateCamera.

Sunday, March 25, 2012

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

Well that's a common error if u are messing around with google maps api.



go to Project > Properties > Java Build Path > Libraries and ensure that there is no android.jar or maps.jar directly included. You should only have Google Apis with at leastmaps.jar and android.jar as leaves.



As u can see in the image there are two maps.jar . You have to delete the first one and just leave the leaves of Google APIs



Tuesday, March 20, 2012

E/MapActivity(2964): Couldn't get connection factory client

It has something to do with Android Google Maps.

I guess its not the API KEY, since im not having any problems and my app works just fine.

Seems it still is a bug no matter what SDK version you use.

Also from Stackoverflow is provided a workaround check the link here