I had shown latitudes and longitudes in Google map when i click marker it display a balloon on which gallery name and address are written
I want when I click on balloon that gallery name are fetched how to achieve this below is my code:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.map);
mapView.setBuiltInZoomControls(true);
mapOverlays = mapView.getOverlays();
drawable1 = getResources().getDrawable(R.drawable.greenballon);
itemizedOverlay = new MyItemizedOverlay(drawable1, mapView);
drawable2 = getResources().getDrawable(R.drawable.blueballon);
itemizedOverlay2 = new MyItemizedOverlay(drawable2, mapView);
drawable3 = getResources().getDrawable(R.drawable.redballon);
itemizedOverlay3 = new MyItemizedOverlay(drawable3, mapView);
for(int i=0;i<20;i++)
{
if(sitesList.getType().get(i).equalsIgnoreCase("Centros Culturales"))
{
name = sitesList.getLatitude().get(i);
name1 = sitesList.getLongitude().get(i);
Log.i("centos culturales lat" + i,name);
Log.i("culturarls longitiitude"+i,name1);
point = new GeoPoint((int) (Double.parseDouble(name) * 1E6),
(int) (Double.parseDouble(name1) * 1E6));
OverlayItem overlayItem = new OverlayItem(point, sitesList.getGalleryname().get(i),
sitesList.getAddress().get(i));
itemizedOverlay.addOverlay(overlayItem);
}
}
for(int i=0;i<sitesList.getLatitude().size();i++)
{
if(sitesList.getType().get(i).equalsIgnoreCase("Centros Culturales"))
{
name = sitesList.getLatitude().get(i);
name1 = sitesList.getLongitude().get(i);
Log.i("centos culturales lat" + i,name);
Log.i("culturarls longitiitude"+i,name1);
point = new GeoPoint((int) (Double.parseDouble(name) * 1E6),
(int) (Double.parseDouble(name1) * 1E6));
OverlayItem overlayItem = new OverlayItem(point, sitesList.getGalleryname().get(i),
sitesList.getAddress().get(i));
itemizedOverlay.addOverlay(overlayItem);
}
}
for(int i=0;i<sitesList.getLatitude().size();i++)
{
if(sitesList.getType().get(i).equalsIgnoreCase("Residencias"))
{
name = sitesList.getLatitude().get(i);
name1 = sitesList.getLongitude().get(i);
Log.i("residencias latitute" + i,name);
Log.i("residencias longitiitude"+i,name1);
point3 = new GeoPoint((int) (Double.parseDouble(name) * 1E6),
(int) (Double.parseDouble(name1) * 1E6));
OverlayItem overlayItem = new OverlayItem(point3, sitesList.getGalleryname().get(i),
sitesList.getAddress().get(i));
itemizedOverlay2.addOverlay(overlayItem);
}
}
mapOverlays.add(itemizedOverlay);
mapOverlays.add(itemizedOverlay2);
**//actuaaly i show lat long in google map according to "gallery type"..so here how to get data on tap of baloon...??????**
#Override
protected boolean onBalloonTap(int index, OverlayItem item) {
for(int i=0;i<sitesList.getLatitude().size();i++)
{
if(sitesList.getType().get(i).equalsIgnoreCase("Centros Culturales"))
{
array_galleryname1 = new String[sitesList.getGalleryname().size()];
array_galleryurl1 = new String[sitesList.getImagesurl().size()];
galleryname = sitesList.getGalleryname().get(i);
galleryurl = sitesList.getImagesurl().get(i);
array_galleryname1[index] = galleryname;
array_galleryurl1[index] = galleryurl;
}
}
Toast.makeText(c, array_galleryname1[index] + index,
Toast.LENGTH_LONG).show();
for(int i=0;i<sitesList.getLatitude().size();i++)
{ if(sitesList.getType().get(i).equalsIgnoreCase("Residencias"))
{
array_galleryname = new String[sitesList.getGalleryname().size()];
array_galleryurl1 = new String[sitesList.getImagesurl().size()];
galleryname = sitesList.getGalleryname().get(i);
galleryurl = sitesList.getImagesurl().get(i);
array_galleryname[index] = galleryname;
array_galleryurl1[index] = galleryurl;
}
}
You have to override onTap() .
See this link. http://developer.android.com/resources/tutorials/views/hello-mapview.html
Related
I have an application where I fetch longitude and latitude from my database and want to display it in a MapView. I am able to show the one stored most recently, but I think some array is needed in a for loop to add it in an overlay. I don't know how to implement it though.
Here is my buttonClick on which it will fetch lat/long and display it in a MapView:
buttonShowMarkers = (Button) findViewById(R.id.button_SHOW_MARKERS);
buttonShowMarkers.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
try {
db = openOrCreateDatabase("LocationFetch.db", MODE_PRIVATE , null);
cursor = db.rawQuery("SELECT * FROM user" , null);
cursor.moveToFirst();
do {
int dataID = cursor.getColumnIndex("id");
String dataString = cursor.getString(0);
Log.d("ID DATA FROM DATABASE---->" , dataString);
String dataNAME = cursor.getString(1).toString().trim();
Log.d("NAME DATA FROM DATABASE---->", dataNAME);
String dataLAT = cursor.getString(2).toString().trim();
Log.d("LAT DATA FROM DATABASE----->" , dataLAT);
int latitude = cursor.getColumnIndex("latitude");
String dataLON = cursor.getString(3).toString().trim();
Log.d("LON DATA FROM DATABASE----->" , dataLON);
int longitude = cursor.getColumnIndex("longitude");
showLatLon(latitude , longitude , dataNAME);
// ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
/* List<Overlay> ListOverlays = mapView.getOverlays();
* OverlayItem[] markerItem = {new OverlayItem(new GeoPoint(latitude, longitude) , ""+dataNAME , ""+dataString)};
* OverlayItem markerItem = new OverlayItem(new GeoPoint((int)(latitude *1E6), (int)(longitude *1E6)) , ""+dataNAME , ""+dataString);
* drawableOne = getResources().getDrawable(R.drawable.location_blue);
* helloItemizedOverlay = new HelloItemizedOverlay(drawableOne);
* helloItemizedOverlay.addOverlayItem(markerItem);
* mapView.getOverlays().add(helloItemizedOverlay);
* ListOverlays.add(myItemizedOverlay);*/
//for(int i = dataID ; )
} while (cursor.moveToNext());
/*String[] arrLat = new String[]{LATdata};
String[] arrLon = new String[]{LONdata};*/
//showLatLon(dataLAT , dataLON);
cursor.moveToNext();
} catch(SQLException e) {
e.printStackTrace();
} finally {
cursor.close();
}
db.close();
}
private void showLatLon(int latitude , int longitude , String nAMEdata) {
// GeoPoint point = new GeoPoint( (latitude) , (latitude) );
List<Overlay> ListOverlays = mapView.getOverlays();
//OverlayItem[] markerItem = {new OverlayItem(new GeoPoint(latitude, longitude) , ""+dataNAME , ""+dataString)};
OverlayItem markerItem = new OverlayItem(new GeoPoint(latitude,latitude ) , ""+nAMEdata , null);
drawableOne = getResources().getDrawable(R.drawable.location_blue);
helloItemizedOverlay = new HelloItemizedOverlay(drawableOne);
helloItemizedOverlay.addOverlayItem(markerItem);
mapView.getOverlays().add(helloItemizedOverlay);
ListOverlays.add(myItemizedOverlay);
}
});
You can try using this solution -
Create a class named LatLonPoint - this basically does the conversion from latlon to GeoPoint -
public class LatLonPoint extends GeoPoint {
public LatLonPoint(double latitude, double longitude) {
super((int) (latitude * 1E6), (int) (longitude * 1E6));
}
}
Create a Itemized Overlay -
public class HelloItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
private Context mContext;
public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
super(boundCenterBottom(defaultMarker));
mContext = context;
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
#Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
#Override
public int size() {
return mOverlays.size();
}
#Override
protected boolean onTap(int index) {
OverlayItem item = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.show();
return true;
}
#Override
public boolean onKeyDown(int keyCode, KeyEvent event, MapView mapView) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
}
return super.onKeyDown(keyCode, event, mapView);
}
}
Now in the main activity -
try {
db = openOrCreateDatabase("LocationFetch.db", MODE_PRIVATE , null);
cursor = db.rawQuery("SELECT * FROM user" , null);
cursor.moveToFirst();
do {
int dataID = cursor.getColumnIndex("id");
String dataString = cursor.getString(0);
Log.d("ID DATA FROM DATABASE---->" , dataString);
String dataNAME = cursor.getString(1).toString().trim();
Log.d("NAME DATA FROM DATABASE---->", dataNAME);
String dataLAT = cursor.getString(2).toString().trim();
Log.d("LAT DATA FROM DATABASE----->" , dataLAT);
int latitude = cursor.getColumnIndex("latitude");
String dataLON = cursor.getString(3).toString().trim();
Log.d("LON DATA FROM DATABASE----->" , dataLON);
int longitude = cursor.getColumnIndex("longitude");
// Add the item here --
itemizedoverlay.addOverlay(new OverlayItem(new LatLonPoint(latitude, longitude), dataNAME, null));
//showLatLon(latitude , longitude , dataNAME);
// ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
/* List<Overlay> ListOverlays = mapView.getOverlays();
* OverlayItem[] markerItem = {new OverlayItem(new GeoPoint(latitude, longitude) , ""+dataNAME , ""+dataString)};
* OverlayItem markerItem = new OverlayItem(new GeoPoint((int)(latitude *1E6), (int)(longitude *1E6)) , ""+dataNAME , ""+dataString);
* drawableOne = getResources().getDrawable(R.drawable.location_blue);
* helloItemizedOverlay = new HelloItemizedOverlay(drawableOne);
* helloItemizedOverlay.addOverlayItem(markerItem);
* mapView.getOverlays().add(helloItemizedOverlay);
* ListOverlays.add(myItemizedOverlay);*/
//for(int i = dataID ; )
} while (cursor.moveToNext());
// Add all itemized overlay here
mapOverlays.add(itemizedoverlay);
/*String[] arrLat = new String[]{LATdata};
String[] arrLon = new String[]{LONdata};*/
//showLatLon(dataLAT , dataLON);
//cursor.moveToNext();
} catch(SQLException e) {
e.printStackTrace();
} finally {
cursor.close();
}
For the above block you have to initialize these two items beffore the do.. while -
List<Overlay> mapOverlays = mMapView.getOverlays();
and
HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(
drawable, this);
EDIT-- Adding iterating Cursor Part -
Drawable drawable = this.getResources().getDrawable(
R.drawable.ic_launcher);
List<Overlay> mapOverlays = mMapView.getOverlays();
HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(
drawable, this);
while(cursor.moveToNext())
{
// get the values --
int dataID = cursor.getColumnIndex("id");
String dataString = cursor.getString(0);
Log.d("ID DATA FROM DATABASE---->" , dataString);
String dataNAME = cursor.getString(1).toString().trim();
Log.d("NAME DATA FROM DATABASE---->", dataNAME);
String dataLAT = cursor.getString(2).toString().trim();
Log.d("LAT DATA FROM DATABASE----->" , dataLAT);
int latitude = cursor.getColumnIndex("latitude");
String dataLON = cursor.getString(3).toString().trim();
Log.d("LON DATA FROM DATABASE----->" , dataLON);
int longitude = cursor.getColumnIndex("longitude");
// Assuming your logic for retrieving values is correct
// Add into the itemized Overlay here
itemizedoverlay.addOverlay(new OverlayItem(new LatLonPoint(latitude, longitude), dataNAME, null));
}
mapOverlays.add(itemizedoverlay);
I want display Google maps in the Android Based on the user edit text value lat and lang and place name and then i finally click on the search button the maps was displayed in Android.
you need to create some object like.
MapView mapView;
MapController mc;
GeoPoint p;
String add = "";
double lattitude ;
double longitude;
Searching location by Name and show Maps.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Search Location");
alert.setMessage("Enter Location Name: ");
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
// Do something with value!
Log.d("value", value);
Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
value, 5);
String add = "";
if (addresses.size() > 0) {
p = new GeoPoint(
(int) (addresses.get(0).getLatitude() * 1E6),
(int) (addresses.get(0).getLongitude() * 1E6));
mc.animateTo(p);
mapView.invalidate();
}
} catch (IOException e) {
e.printStackTrace();
}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
Searching location by Entering Latitude and Longitude and show map..
searchUsingLangLat()
{
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.latlong, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Search Location");
alert.setMessage("Enter Lattitude and Longitude: ");
alert.setView(textEntryView);
// Set an EditText view to get user input
AlertDialog latLongPrompt = alert.create();
final EditText lat = (EditText) textEntryView.findViewById(R.id.lat);
final EditText longi = (EditText) textEntryView.findViewById(R.id.longi);
//alert.setView(lat);
//alert.setView(longi);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(getBaseContext(), "clicked ok ", Toast.LENGTH_SHORT).show();
Double value1 = Double.parseDouble(lat.getText().toString());
Double value2 = Double.parseDouble(longi.getText().toString());
// Do something with value!
// Log.d("value1", value1);
//Log.d("value2", value2);
p = new GeoPoint(
(int) (value1 * 1E6),
(int) (value2 * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
And finally you need to show map. write following code in onCreate() method.
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
mc = mapView.getController();
String coordinates[] = {"1.352566007", "103.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.setCenter(p);
mc.setZoom(17);
//---Add a location marker---
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);
Try this code...if you get any error free to ask.
If you store the Latitude and Longitude of a bunch of locations in a SQLite Database, You could retrieve these values and place them each in an OverlayItem class for use in Google's Map code!!
Database name: database
Table name: place
Fields in place Table:
id
title
description
latitude
longitude
You would want to do a query like this:
SELECT title, description, latitude, longitude
FROM place
Which can be done in Android like this:
// get your database object here using your DbHelper object and the
// method getReadableDatabase();
ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
Cursor locationCursor = databaseObject.query("place", new String[] {
"title", "description", "latitude", "longitude" }, null, null,
null, null, null);
locationCursor.moveToFirst();
do {
String title = locationCursor.String(locationCursor
.getColumnIndex("title"));
String description = locationCursor.String(locationCursor
.getColumnIndex("description"));
int latitude = (int) (locationCursor.getDouble(locationCursor
.getColumnIndex("latitude")) * 1E6);
int longitude = (int) (locationCursor.getDouble(locationCursor
.getColumnIndex("longitude")) * 1E6);
items.add(new OverlayItem(new GeoPoint(latitude, longitude), title,
description));
} while (locationCursor.moveToNext());
You need to times the double values by 1e6 because Android uses an integer representation of the lat/long values. If you already took care of this when populating the database, skip the multiplication and use locationCursor.getInt(...).
So first I checked if there is a Goecoder service present in or not....
Then I use this service and check the result from getFromLocationName, and then i make the point of it which I add to my overlay and display it...But for some reason, it does not display anything.
private void convert_Points() throws IOException {
// initialization of overlays
mapOverlays = mapV.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.pin);
itemizedoverlay = new ItemizedOverlay(drawable);
// check if getFromLocationName is present or not
if (!Geocoder.isPresent()){
Toast.makeText(getBaseContext(),"Sorry! Geocoder service not Present.", Toast.LENGTH_LONG).show();
}
else{
// make OverlayItem by creating a GeoPoint that defines our map coordinates
Geocoder geocoder = new Geocoder(this);
List<Address> geoResults = geocoder.getFromLocationName("Empire State Building", 5,-44.00, 111.00, -12.0, 155.0);
Address location = geoResults.get(0);
location.getLatitude();
location.getLongitude();
String s=Double.toString(geoResults.get(0).getLatitude());
Toast.makeText(getBaseContext(),s, Toast.LENGTH_LONG).show();
GeoPoint point= new GeoPoint( (int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6));
OverlayItem overlayitem = new OverlayItem(point, "", "");
// add this OverlayItem to a collection in the ItemizedOverlay
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
}
}
I have a for loop, inside which I'm calling a method to show the poi's in map. Now what I am trying to do is to show each poi in a sequence. I mean now the for loop completes at a stretch and at last is presented with the final output.
But I want it to be in order, that mean each time for loop iterates I should be able to see the animation where these geopoints are moving from place to place.
Here is my code,
for (i=currentPOIindex;i<arraypoi.size();i++) {
poi = arraypoi.get(i);
latitude = poi.getLatitude().toString();
longitude = poi.getLongitude().toString();
placename = poi.getPlaceName().toString();
mapdescription = poi.getPoiDecsription().toString();
lat = Double.parseDouble(latitude);
lng = Double.parseDouble(longitude);
//use the poiIndex to identify which poi is highlighted
itemizedOverlay.poiIndex = i;
geopoint = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
OverlayItem overlayitem = new OverlayItem(geopoint,fitTextToMapCallout(placename), fitTextToMapCalloutDescription("hello"));
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
//this method is meant to move to each geopint one by one.
//And I am trying to give a delay before this method is called
moveToPOI(i);
}
public void moveToPOI(int currentPOI) {
try {
AudioMapOverLay overlay = (AudioMapOverLay) mapOverlays.get(currentPOI);
poi = arraypoi.get(currentPOI);
latitude = poi.getLatitude().toString();
longitude = poi.getLongitude().toString();
placename = poi.getPlaceName().toString();
lat = Double.parseDouble(latitude);
lng = Double.parseDouble(longitude);
geopoint = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
overlay.onForwardOrRewind(currentPOI, overlay);
} catch (Exception e) {
e.printStackTrace();
}
}
I tried using Thread.sleep(long ms); But it is not the solution, can any one tell me what to do?
You Should have to do some thing like this in your For Loop:
final Handler handler = new Handler();
for (i=currentPOIindex;i<arraypoi.size();i++) {
poi = arraypoi.get(i);
latitude = poi.getLatitude().toString();
longitude = poi.getLongitude().toString();
placename = poi.getPlaceName().toString();
mapdescription = poi.getPoiDecsription().toString();
lat = Double.parseDouble(latitude);
lng = Double.parseDouble(longitude);
//use the poiIndex to identify which poi is highlighted
itemizedOverlay.poiIndex = i;
geopoint = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
OverlayItem overlayitem = new OverlayItem(geopoint,fitTextToMapCallout(placename), fitTextToMapCalloutDescription("hello"));
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
//this method is meant to move to each geopint one by one.
//And I am trying to give a delay before this method is called
handler.postDelayed(new Runnable() {
#Override
public void run() {
//Do something after 100ms
moveToPOI(i);
}
}, 100/*This is Delay Value in Milli Second set which suit for your /*);
}
You could use Handler postDelayed and Runnable which does the actual operation, inside Runnable run() you remove callbacks for that runnable and post it again to the handler. If you are getting some callbacks for the operation finished you can use that to trigger the runnable again.
Handler handler = new Handler()
handler.postDelayed(myRunnable, MY_DELAY);
Runnable myRunnable = new Runnable() {
public void run() {
//do the stuff
// Check if another loop sequence is needed and start runnable again
handler.removeCallbacks(myRunnable);
handler.postDelayed(myRunnable, MY_DELAY); }
Finally I have come up with the answer. #Niko and #Herry, I don't know if this is similar to your code.
here is my change,
notification = new Runnable() {
public void run() {
testgeo();
}
};
handler.postDelayed(notification, 1500);
where testge0() is,
private void testgeo() {
poi = arraypoi.get(index);
latitude = poi.getLatitude().toString();
longitude = poi.getLongitude().toString();
placename = poi.getPlaceName().toString();
// mapdescription = poi.getPoiDecsription().toString();
lat = Double.parseDouble(latitude);
lng = Double.parseDouble(longitude);
if (index == currentPOIindex) {
drawable = this.getResources().getDrawable(R.drawable.poiiconactive);
itemizedOverlay = new AudioMapOverLay(drawable, objMapView,this);
} else {
drawable = this.getResources().getDrawable(R.drawable.mapicon);
itemizedOverlay = new AudioMapOverLay(drawable, objMapView,this);
}
itemizedOverlay.poiIndex = index;
geopoint = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
OverlayItem overlayitem = new OverlayItem(geopoint,fitTextToMapCallout(placename),
fitTextToMapCalloutDescription("hello"));
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
moveToPOI(index);
}
But thank you for your help. This is working for me
I want to remove same overlay at the specific position. This is my code for add the overlay, but how can get the position for every overlay?
public void visual_overlay(List<DatiOverlay> list_overlay){
CustomOverlay itemized_overlays = null;
GeoPoint point = null;
for(int ov=0;ov<list_overlay.size();ov++){
itemized_overlays = new CustomOverlay(drawable,mappa, Integer.toString(list_overlay.get(ov).get_id_segnalazione()),list_overlay.get(ov).get_via(),list_overlay.get(ov).get_citta(),list_overlay.get(ov).get_descrizione(),list_overlay.get(ov).get_cek_feed());
point = new GeoPoint((int)(list_overlay.get(ov).get_lat() * 1E6), (int)(list_overlay.get(ov).get_lng() * 1E6));
OverlayItem overlayItem = new OverlayItem(point, list_overlay.get(ov).get_nome(), list_overlay.get(ov).get_prezzo());
itemized_overlays.addOverlay(overlayItem);
mappa.invalidate();
mappa.getOverlays().add(itemized_overlays);
}
You remove an overlay from a MapView like this:
List<Overlay> mapOverlays = mapView.getOverlays();
if (mapOverlay != null) mapOverlays.remove(someOverlay);