+ if (id == R.id.action_show_location) {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
+ String location = preferences.getString(getString(R.string.pref_location_key),
+ getString(R.string.pref_location_default));
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ Uri geoLocation;
+ try {
+ geoLocation = Uri.parse("geo:0,0?q=" + URLEncoder.encode(location, "UTF-8"));
+ intent.setData(geoLocation);
+ } catch (UnsupportedEncodingException e) {
+ Log.e(LOG_TAG, "Error ", e);
+ }
+ if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
+ startActivity(intent);
+ }
+
+ }