It looks like there's two things happening here.
1) You've missed the new
keyword from before calling the constructor.
2) The parameter you're passing in to the Geocoder constructor is incorrect. You're passing in a Locale
where it's expecting a Context
.
There are two Geocoder
constructors, both of which require a Context
, and one also taking a Locale
:
Geocoder(Context context, Locale locale)
Geocoder(Context context)
Solution
Modify your code to pass in a valid Context and include new
and you should be good to go.
Geocoder myLocation = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> myList = myLocation.getFromLocation(latPoint, lngPoint, 1);
Note
If you're still having problems it may be a permissioning issue. Geocoding implicitly uses the Internet to perform the lookups, so your application will require an INTERNET
uses-permission tag in your manifest.
Add the following uses-permission node within the manifest
node of your manifest.
<uses-permission android:name="android.permission.INTERNET" />