我尝试通过手机缓存显示某些经度和纬度
myLocation = loc.getLastKnownLocation(LocationManager.GPS_PROVIDER);
但是,当我拨打viewmap(myLocation)
时,它会崩溃......
public void viewMap(Location loc){
String uri = "geo:" + loc.getLatitude()+"," + loc.getLongitude() +
"?q=" + loc.getLatitude()+"," + loc.getLongitude() +
"(7 Dash)";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
}
答案 0 :(得分:0)
试试这个
public void viewMap(Location loc){
String uri = "geo:" + loc.getLatitude()+"," + loc.getLongitude() +
"?q=" + loc.getLatitude()+"," + loc.getLongitude() +
"(7 Dash)";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
}