【发布时间】:2015-11-13 08:46:28
【问题描述】:
我尝试在我的 android 应用程序中显示用户位置,但它不起作用!包管理器始终为空。
private void openPrefredLocationInMap (){
String location =
PreferenceManager.getDefaultSharedPreferences(this)
.getString(getString(R.string.pref_location_key)
, getString(R.string.pref_defult));
Uri geoLocation = Uri.parse("geo:0,0?").buildUpon()
.appendQueryParameter("q", location).build();
Intent intent= new Intent(Intent.ACTION_VIEW,geoLocation);
if (intent.resolveActivity(getPackageManager()) != null)
startActivity(intent);
else
Log.d("package","couldnt call"+location);
}
【问题讨论】: