Created
April 9, 2016 06:06
-
-
Save derohimat/b79e3dd6d650481e7a4c11eba5d14278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void onPreferedLocationInMap() { | |
SharedPreferences sharedPreferences = PreferenceManager | |
.getDefaultSharedPreferences(mContext); | |
String location = sharedPreferences.getString(getString(R.string.pref_location_key), | |
getString(R.string.pref_location_default)); | |
Uri geoLocation = Uri.parse("geo:0,0?").buildUpon() | |
.appendQueryParameter("q", location) | |
.build(); | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(geoLocation); | |
if (intent.resolveActivity(mContext.getPackageManager()) != null) { | |
startActivity(intent); | |
} else { | |
Log.e(MainActivityFragment.class.getSimpleName(), "Couldn't call " + location + ", no result for this"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment