Geocoder(Context, Locale) problem.

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

Geocoder(Context, Locale) problem.

Postby thetuxracer » Tue Jan 26, 2010 10:33 am

Hi,
I was creating a Maps application, and am stuck at this problem, as a last resort, I am posting here.

I tried the following statements, that give me an error in Eclipse, saying: The constructor Geocoder(MapsActivity.MapOverlay, Locale) is undefined

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Geocoder gc = new Geocoder(this, en_US);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Geocoder gc = new Geocoder(this, Locale.getDefault());
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


I have imported the relevant package, viz android.location.Geocoder,

What do I seem to be missing? No one seems to be having this problem, where i googled.

Please Help, Thanks!
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Top

Postby Draffodx » Tue Jan 26, 2010 11:55 am

Can you post the code where you have the Geocoder constructor placed?

It appears you may be trying to call it in an Overlay which I presume you cant do as the error is saying MapsActivity.MapOverlay is not a valid parameter to pass to the constructor.

If you post the code showing the class or method that the constructor is placed it will be easier to see whats going wrong
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby thetuxracer » Tue Jan 26, 2010 12:10 pm

DUPLICATE POST, CLEANED by thetuxracer.
Last edited by thetuxracer on Tue Jan 26, 2010 12:12 pm, edited 1 time in total.
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Postby thetuxracer » Tue Jan 26, 2010 12:11 pm

Draffodx wrote:Can you post the code where you have the Geocoder constructor placed?

It appears you may be trying to call it in an Overlay which I presume you cant do as the error is saying MapsActivity.MapOverlay is not a valid parameter to pass to the constructor.

If you post the code showing the class or method that the constructor is placed it will be easier to see whats going wrong


I dug around, and came up with this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault());
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


It solved the issue.

Thanks :)
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Postby Draffodx » Tue Jan 26, 2010 1:24 pm

Good stuff.

The error was because you were calling it within an inner overlay class, so the context (this) was passing the overlay into the method whereas you needed to send the actual class that extended mapActivity.
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby thetuxracer » Fri Feb 12, 2010 10:28 am

thanks, that was helpful :)
thetuxracer
Developer
Developer
 
Posts: 26
Joined: Mon Jan 04, 2010 7:59 am
Location: Nashik, MH, India

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests