[android-developers] Re: onTap display toast or message

2009-07-14 Thread skink



On Jul 14, 7:35 pm, Mark Murphy

 Just pass in the activity to your ItemizedOverlay's subclass'
 constructor, and use it to create your Toast.


be careful though, since passing Activity context to Toast can in some
situations be dangerous, see:

http://groups.google.com/group/android-developers/browse_thread/thread/de2f0cebec002303/aae1c4a709e63548#aae1c4a709e63548

thanks
pskink
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: onTap display toast or message

2009-07-14 Thread alexdonnini

Thanks. Good point. I have seen the behavior described in the thread
you pointed to.

Alex

On Jul 14, 3:37 pm, skink psk...@gmail.com wrote:
 On Jul 14, 7:35 pm, Mark Murphy



  Just pass in the activity to your ItemizedOverlay's subclass'
  constructor, and use it to create your Toast.

 be careful though, since passing Activity context to Toast can in some
 situations be dangerous, see:

 http://groups.google.com/group/android-developers/browse_thread/threa...

 thanks
 pskink
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: onTap display toast or message

2009-07-13 Thread Mark Murphy

alexdonnini wrote:
 I looked for any information about onTap event processing for itemized
 overlays in this group. There is a lot of useful information but I
 could not find the answer to one question.
 
 The tutorial by Mark Murphy on itemized overlays, 
 http://androidguys.com/?p=1413
 
 describes how to generate a Toast message whenever an onTap event
 occurs.

Hey, that name looks familiar...

 My custom itemized
 overlay activity is included in the application package as a public
 activity.

Neither Overlay nor ItemizedOverlay are subclasses of Activity, so I do
not understand the above sentence.

 I have had trouble in correctly identifying the context for the Toast.

Use the activity hosting the MapView. If you are somehow getting that
activity inside another (e.g., shoehorned a MapView-wielding activity
into a TabActivity), try using the top-most activity.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android 1.5 Programming Books: http://commonsware.com/books.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: onTap display toast or message

2009-07-13 Thread alexdonnini

Hi Mark,

Thanks. What I meant is that I thought that in your example,
SitesOverlay is an inner class of the map activity NooYawk. In my
case, the custom itemized overlay class is not an inner class of the
map activity. This means that an entry like NooYawk.this will not
work.

Am I wrong? I have not been able to get it to work.

Alex

On Jul 13, 5:16 pm, Mark Murphy mmur...@commonsware.com wrote:
 alexdonniniwrote:
  I looked for any information about onTap event processing for itemized
  overlays in this group. There is a lot of useful information but I
  could not find the answer to one question.

  The tutorial by Mark Murphy on itemized 
  overlays,http://androidguys.com/?p=1413

  describes how to generate a Toast message whenever an onTap event
  occurs.

 Hey, that name looks familiar...

  My custom itemized
  overlay activity is included in the application package as a public
  activity.

 Neither Overlay nor ItemizedOverlay are subclasses of Activity, so I do
 not understand the above sentence.

  I have had trouble in correctly identifying the context for the Toast.

 Use the activity hosting the MapView. If you are somehow getting that
 activity inside another (e.g., shoehorned a MapView-wielding activity
 into a TabActivity), try using the top-most activity.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android 1.5 Programming Books:http://commonsware.com/books.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: onTap display toast or message

2009-07-13 Thread alexdonnini

Scott Mikolyski (sc...@mikolyski.com) solved my problem.

He suggested I add a private context to the custom itemized overlay,
modify the itemized overlay constructor to assign a context to the
private contxt. Then pass the context of the map activity to the
instantiation of the custom itemized overlay.

Alex

P.S. I am still interested in implementing a display of detail marker
information when hovering over a marker as implemented in many
location/map based products.


On Jul 13, 9:25 pm, alexdonnini alexdonn...@ieee.org wrote:
 Hi Mark,

 Thanks. What I meant is that I thought that in your example,
 SitesOverlay is an inner class of the map activity NooYawk. In my
 case, the custom itemized overlay class is not an inner class of the
 map activity. This means that an entry like NooYawk.this will not
 work.

 Am I wrong? I have not been able to get it to work.

 Alex

 On Jul 13, 5:16 pm, Mark Murphy mmur...@commonsware.com wrote:

  alexdonniniwrote:
   I looked for any information about onTap event processing for itemized
   overlays in this group. There is a lot of useful information but I
   could not find the answer to one question.

   The tutorial by Mark Murphy on itemized 
   overlays,http://androidguys.com/?p=1413

   describes how to generate a Toast message whenever an onTap event
   occurs.

  Hey, that name looks familiar...

   My custom itemized
   overlay activity is included in the application package as a public
   activity.

  Neither Overlay nor ItemizedOverlay are subclasses of Activity, so I do
  not understand the above sentence.

   I have had trouble in correctly identifying the context for the Toast.

  Use the activity hosting the MapView. If you are somehow getting that
  activity inside another (e.g., shoehorned a MapView-wielding activity
  into a TabActivity), try using the top-most activity.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  Android 1.5 Programming Books:http://commonsware.com/books.html


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---