Creating New Activity Screen from within ItemizedOverlay

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Creating New Activity Screen from within ItemizedOverlay

Postby authorityaction » Thu Dec 03, 2009 10:20 pm

I am trying to make some clickable map overlays that trigger a new screen to appear when a user taps on the markers. I have a mapview setup that creates markers using the ItemizedOverlay. Inside of ItemizedOverlay I override onTap(), I know that this work when clicking on the markers. How can I create a new screen from within ItemizedOverlay?

I am having trouble because I cannot use startActivity() since Activity is not extending, ItemizedOverlay is.

Any ideals?

Thanks.
authorityaction
Freshman
Freshman
 
Posts: 2
Joined: Thu Dec 03, 2009 10:14 pm

Top

Postby padde » Thu Dec 03, 2009 10:45 pm

Just pass the context of the activity to the constructor of your itemizedoverlay.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. class bla extends Activity {
  3.  
  4.     ...
  5.  
  6.     MyItemOverlay io = new MyItemOverlay(this);
  7.  
  8.     ...
  9.  
  10. }
  11.  
  12.  
  13.  
  14. class MyItemOverlay extends ...... {
  15.  
  16.     private Context ctx;
  17.  
  18.  
  19.  
  20.     public MyItemOverlay(Context context) {
  21.  
  22.         this.ctx = context;
  23.  
  24.     }
  25.  
  26.  
  27.  
  28.     protected boolean onTap(...) {
  29.  
  30.         ctx.startActivity(...);
  31.  
  32.     }
  33.  
  34. }
  35.  
  36.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Something like that....
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Postby authorityaction » Thu Dec 03, 2009 11:10 pm

I had a similar thought process but was unsure on how to accomplish this. Thank you for your reply, I will be trying this soon.
authorityaction
Freshman
Freshman
 
Posts: 2
Joined: Thu Dec 03, 2009 10:14 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 6 guests