how to show the current location as arrow in Google Maps Android API V2? how to show the current location as arrow in Google Maps Android API V2? android android

how to show the current location as arrow in Google Maps Android API V2?


Move!

The location will be indicated on the map by a small blue dot if the device is stationary, or as a chevron if the device is moving.

From the Google Maps v2 documentation


Getting the blue arrow like what we see in Google's Google Maps app by default or through the API on Android is not possible according to this post. I conclude that, we may be on our own for that particular feature. Just my 2 cents.


Use below it works for to get current location

LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);         Criteria criteria = new Criteria();   String provider = locationManager.getBestProvider(criteria, false);Location location = locationManager.getLastKnownLocation(provider); if (location != null) {                    System.out.println("Provider " + provider + " has been selected.");                    onLocationChanged(location);                  } Geocoder geocoder = new Geocoder(ViewTestDrive.this, Locale.getDefault());                List<Address> addresses = null;                try {                    addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);                } catch (IOException e) {                    e.printStackTrace();                    // Update address field with the exception.                    //Message.obtain(mHandler, UPDATE_ADDRESS, e.toString()).sendToTarget();                }                String addressText = null;                if (addresses != null && addresses.size() > 0) {                    Address address = addresses.get(0);                    // Format the first line of address (if available), city, and country name.                     addressText = String.format("%s, %s, %s",                            address.getMaxAddressLineIndex() > 0 ? address.getAddressLine(0) : "",                            address.getLocality(),                            address.getCountryName());                    // Update address field on UI.                    //Message.obtain(mHandler, UPDATE_ADDRESS, addressText).sendToTarget();                }                Intent intent = new Intent(android.content.Intent.ACTION_VIEW,                         Uri.parse("http://maps.google.com/maps?saddr="+addressText+"&daddr="+));                intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");                        startActivity(intent);@Overridepublic void onLocationChanged(Location location) {    int lat = (int) (location.getLatitude());    int lng = (int) (location.getLongitude());    String.valueOf(lat);    String.valueOf(lng);}@Overridepublic void onProviderDisabled(String provider) {    Toast.makeText(this, "Disabled provider " + provider,            Toast.LENGTH_SHORT).show();}@Overridepublic void onProviderEnabled(String provider) {    Toast.makeText(this, "Enabled new provider " + provider,            Toast.LENGTH_SHORT).show();}@Overridepublic void onStatusChanged(String provider, int status, Bundle extras) {    // TODO Auto-generated method stub}