Context for displaying a message

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

Context for displaying a message

Postby trevor.vb » Tue Mar 02, 2010 9:15 pm

Hello,

I'm having a bit of trouble finding the right context for display a message after an onTap on an Overlay. I have a class seperate from my main class which is an itemized overlay. I believe that I need the main class to be the context but I'm not sure how to specify that.

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("IT WORKS!");
builder.show();

If I just do <mainclassname>.this it tells me "No enclosing instance of the type <mainclasname> is accessible in scope", and if I create a context variable in the main class using public Context context = getApplicationContext();, it tells me "Cannot make a static reference to the non-static field <mainclassname>.context".

I'd really appreciate a hand with this.

Thanks.
trevor.vb
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Mar 02, 2010 8:57 pm
Location: Canada

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests