any one can help me? i got some project, my project is make a tourism application, is can show map for every place using latitude and logitude from database, i use this script.
double lat = 0;
double lng = 0;
if(cursor.moveToFirst()){
cursor.moveToPosition(position);
lat = cursor.getDouble(cursor.getColumnIndex("lat"));
lng = cursor.getDouble(cursor.getColumnIndex("lng"));
}
and then, i pass double data lat and lng to map1.class
Intent intent1 = new Intent(this, map1.class);
intent1.putExtra("latx", lat);
intent1.putExtra("lngy", lng);
setResult(RESULT_OK, intent1);
in map1.class, i receive using this script.
Intent i = getIntent();
Double d1 = i.getDoubleExtra("latx", latitude1);
Double d2 = i.getDoubleExtra("lngy", longitude2);
FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment = (SupportMapFragment)myFragmentManager.findFragmentById(R.id.map1);
myMap = mySupportMapFragment.getMap();
LatLng alam3 = new LatLng(d1, d2);
MarkerOptions markerPosong = new MarkerOptions();
markerPosong.position(alam3);
markerPosong.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
and why in fragment map can't show coordinate from latlng .? its like the data double isn't receive the data from database.
Aucun commentaire:
Enregistrer un commentaire