1

i am using this open streetmap from this Implementing Open Street Map, the code is working fine but problem is i want to add a balloon like google map which show in this image Android Mapview Balloons.

Please tell me how can i do that?

Any help would be appreciated.

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Hayya ANAM
  • 575
  • 2
  • 14
  • 38

2 Answers2

0

Create multi-marker OpenStreetMap for Android

http://android-er.blogspot.in/2012/05/create-multi-marker-openstreetmap-for.html

GK_
  • 1,212
  • 1
  • 12
  • 26
0

If u are using eclipse import mapviewbaloons library into your project and than extend MyItemizedOverlay

public class MyItemizedOverlay extends BalloonItemizedOverlay<OverlayItem>

Your onTap will have to become onBaloonTap

@Override
protected boolean onBalloonTap(int index, OverlayItem item) {
    String url = "someurl.com";
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    c.startActivity(i);
    return true;

}

Make sure that you add Context when you start activity in onBaloonTap() in this example c is Context

c.startActivity(i);
v0d1ch
  • 2,738
  • 1
  • 22
  • 27
  • u mean i add googlemapview baloonitemized clas in this application? – Hayya ANAM Dec 03 '12 at 09:06
  • When you add it as a library to your project you will be able to use it. Right click project->properties->android and at the bottom add library. – v0d1ch Dec 03 '12 at 09:10
  • what libraries i add? osm library or mapviebaloons class?? – Hayya ANAM Dec 03 '12 at 09:13
  • u mean add this 2 classes https://github.com/jgilfelt/android-mapviewballoons/tree/master/android-mapviewballoons/src/com/readystatesoftware/mapviewballoons in my application?? – Hayya ANAM Dec 03 '12 at 09:15
  • You should already imported OSM as external jar in your libs folder and mapviewbaloons is library so you add it as a library as I explained – v0d1ch Dec 03 '12 at 09:16
  • import OSM like it is explained here http://android-coding.blogspot.hk/2012/06/osmdroid-interact-with-openstreetmap-to.html – v0d1ch Dec 03 '12 at 09:20
  • is not help me so confusing – Hayya ANAM Dec 03 '12 at 09:23
  • i imprt osm but when i change this line ItemizedOverlay to BalloonItemizedOverlay – Hayya ANAM Dec 03 '12 at 09:25
  • The constructor BalloonItemizedOverlay(Drawable, ResourceProxy) is undefined – Hayya ANAM Dec 03 '12 at 09:26
  • The method add(Overlay) in the type List is not applicable for the arguments (MyItemizedOverlay) – Hayya ANAM Dec 03 '12 at 09:28
  • OK check out these two links http://stackoverflow.com/questions/9362137/custom-information-bubble-on-tap-for-overlay-items-using-osmdroid http://code.google.com/p/osmbonuspack/ – v0d1ch Dec 03 '12 at 09:44