0

I'm trying out the info balloon from: https://github.com/jgilfelt/android-mapviewballoons and it's working perfectly. One thing I'm missing is the ability of setting the current location. Does anybody know how to precisely implement that function? Thanks in advance !

Qwyrp
  • 147
  • 1
  • 1
  • 11

2 Answers2

2

Yes, for example I have some url variable which I display in baloon and my onBaloonTap looks like this, where c is context

    @Override
  protected boolean onBalloonTap(int index, OverlayItem item) {
    String url = WebService.upcomigEvent;
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    c.startActivity(i);
    return true;
}
v0d1ch
  • 2,738
  • 1
  • 22
  • 27
0

You can track position by implementing the LocationListener interface, or by using the MyLocationOverlay class. In both, the method onLocationChanged is available, and you can provide it with your own location object that you create, specifying the lat/lng/alt. This in effect 'spoofs' the users location, and this might not be what you want. If you just want to scroll the map to a specific point you can use the animateTo method available in the MapController.

Flynny75
  • 1,593
  • 1
  • 11
  • 11
  • I implemented the LocationListener in MyMap and added the unimplemented methods. In the method onLocationChanged I placed a toast-message. I started the program and simulated a locationchanged by sending a lng/lat value. I expected the toast-message but no. What am I doing wrong maybe something needed to be activated or so? – Qwyrp Apr 04 '12 at 16:49
  • I solved it ! I forgot to set LocationManager and LocationListener now it works like a charm. Thanks for the help – Qwyrp Apr 04 '12 at 19:17
  • An additional question: Is it possible to add an url to this balloon, so when I hit that url it opens the browser with the according url? If so how to achieve that? – Qwyrp Apr 05 '12 at 16:28