下面的input_latitude.getText().toString()跟input_longitude.getText().toString()
是我的EditText叫使用者輸入的
但是取得之後要在*1E6才可以放進下面
double latitude=Double.parseDouble(input_latitude.getText().toString());
double longitude=Double.parseDouble(input_longitude.getText().toString());
String strUri = "google.streetview:cbll="+latitude*1E6+","+longitude*1E6;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
startActivity(intent);
如果要依照目前位置可以用
private GeoPoint geoPoint;
geoPoint.getLatitudeE6(),geoPoint.getLongitudeE6()來取得緯經度
String strUri = "google.streetview:cbll="+
String.valueOf(geoPoint.getLatitudeE6())+","+
String.valueOf(geoPoint.getLongitudeE6());
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
startActivity(intent);
他的格式就是String strUri = "google.streetview:cbll=緯度,經度";
//然後把字串strUri帶入Intent裡
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
//然後啟動Activtity
startActivity(intent);