KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using the following code to create a map and attach a marker to it. I'm also adding a marker listener where I need to get the longitude and latitude of the marker position after dragging. What it does is returnning my current location not the location of the marker after drag. Any help with this part?! package com.example.mysample; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.Projection; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.maps.GeoPoint; import android.location.Location; import android.location.LocationListener; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.view.MotionEvent; import android.widget.Toast; import android.graphics.*; public class MainActivity extends FragmentActivity implements LocationListener { GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GooglePlayServicesUtil .isGooglePlayServicesAvailable(getApplicationContext()); map = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.addMarker(new Marke
Tags (comma-separated)
Save Edits
Cancel