Replace this line
Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault());
with
Geocoder geocoder = new Geocoder(<Your Activity Name>.this, Locale.getDefault());
also please check if you have added these permissions under manifest tag not under the application tag(happened to me once before).
otherwise I don't think anything is wrong with your code. If problem still exists try rebooting your device and then try running code again, as this may be hardware issue.