Toast - I can't get it to work in Eclipse...

by Mark Murphy » Thu, 05 Nov 2009 00:02:01 GMT

Sponsored Links

The first parameter to makeText() needs to be a Context, such as an

Mark Murphy (a Commons Guy)  | 

_Android Programming Tutorials_ Version 1.0 Available!


Toast - I can't get it to work in Eclipse...

by Mark Murphy » Thu, 05 Nov 2009 00:57:25 GMT


Your onTap() is in the correct place. However, HelloItemizedOverlay is
not a Context, and so it cannot be used as the first parameter to

Either make HelloItemizedOverlay an inner class of your MapActivity, or
pass the MapActivity as a parameter to the HelloItemizedOverlay
constructor, or something, then use that object as the first parameter
to makeText().

Mark Murphy (a Commons Guy)  | 

Android Consulting/App Development: 


Sponsored Links

Toast - I can't get it to work in Eclipse...

by Mark Murphy » Thu, 05 Nov 2009 01:15:04 GMT


Not really.

You are using the simple way. You just have the wrong type for the first
parameter to the makeText() method. It would similarly fail if you tried
passing an integer for the first parameter, or a boolean.

You can see an example of using a Toast from an ItemizedOverlay in one
of my book examples. I don't have these examples up on github just yet
(probably this weekend), so I can't directly link to it. For now, visit: 

Scroll down and click on the Source Code link opposite the table of
contents. In the ZIP file, you will see Maps/NooYawk/. Look for the
onTap() implementation there.

Since my ItemizedOverlay is an inner class of my MapActivity, I already
have access to a suitable Context to provide to makeText().

Mark Murphy (a Commons Guy)  | 

Android Development Wiki: 


Other Threads

1. Sending a route to Google Nav via Intent

Is there a way using Google Navigation via the Intent to use a
specific route?  It seems that currently it defaults to a route when
navigation is launched, then once in navigation it gives the option to
choose additional routes.  What I want to do is launch a specific
route as I guess "default" but still have the alternate routes
available once in Navigation.  I have checked out all the query params
for google maps api but it seems not all of them work for navigation.
Is there a parameter that would be equivalent to route?


2. Share - Samsung jabs iPhone's Retina Display, says AMOLED wins

Iphone4 with Multitasking + Retina display..battrenya seboros apa

Samsung joined in the attacks on the iPhone 4's Retina Display with a
retort in the Korean media. A spokesperson for Samsung argued that
quadrupling the resolution actually had little impact on clarity, at
most three to five percent, and that that it would allegedly hike the
battery drain by as much as 30 percent. AMOLED is purportedly better
as it doesn't need a backlight and makes up for any resolution loss in
other ways, such as higher contrast with true black, more accurate
colors and no limits on viewing angles.

"Structurally, [Apple's] IPS LCD technology cannot catch up with
AMOLED display technology," the representative told the Korean Herald.

The iPhone 4 panel is still considered one of the most advanced
displays both for its "invisible pixel" effect and for overcoming most
of the perceived drawbacks of LCD, covering a very wide color gamut
and touting much wider viewing angles than the often cheap LCDs used
in other phones. Samsung's official also omitted well-known drawbacks
of AMOLEDs, including their high relative cost and poor visibility
outdoors. The Galaxy S may solve this by using a Super AMOLED screen
less vulnerable to the effect, but isn't completely immune.

The spokesperson did also partly confirm rumors and said an existing
AMOLED supply shortage may have dissuaded Apple from using the
technique in the iPhone 4, although he denied that Apple had reached
out to Samsung for the option. Prior reports had the iPhone using LCDs
because Samsung couldn't make enough AMOLEDs to match Apple's needed
production levels.

Also, Apple's $500 million contract with LG Display would likely
discourage the use of another contractor for screens, although the
deal wasn't struck exclusively for iPhones.

"Indonesian Android Community [id-android]" 

3. how to filter the objects (addresses) to display only the onscreen objects on map

4. Web Design Guidelines for the Nokia N900 v1.1

5. Update masalah download di spica

6. Store information in android setting menu

7. Upgrade AmonRa di Dream [WTA] Cara update Recovery ROM