0
如何在跟蹤GPS時更新地圖?如何使用意圖更新谷歌地圖?(Android Java)
getmap()
單擊按鈕時正在調用。
public void getMap() {
//if (a != 101.717026 || b!= 3.002034) {
Toast.makeText(TestdbActivity.this,newaddress, Toast.LENGTH_LONG).show();
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://http://maps.google.com.my/maps?f=d&source=s_d&saddr="+newaddress+"&daddr="+params1+""));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
& Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
i.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(i);
}
updategps功能:
public void onLocationChanged(Location location) {
a = location.getLongitude();
b = location.getLatitude();
String message = String.format("New Location \n Longitude: %1$s \n Latitude: %2$s", a, b);
Toast.makeText(TestdbActivity.this, message, Toast.LENGTH_LONG).show();
newaddress = b+","+ a;
return;
}
public void onStatusChanged(String s, int i, Bundle b) {
Toast.makeText(TestdbActivity.this, "Provider status changed",Toast.LENGTH_LONG).show();
}
public void onProviderDisabled(String s) {
Toast.makeText(TestdbActivity.this,"Provider disabled by the user. GPS turned off",Toast.LENGTH_LONG).show();
}
public void onProviderEnabled(String s) {
Toast.makeText(TestdbActivity.this,"Provider enabled by the user. GPS turned on", Toast.LENGTH_LONG).show();
}
我可以做一個while
循環?如果使用while
循環?
好吧,我想我得到你的觀點。那麼是你爲我推薦的教程嗎?因爲我仍然是Android java的初學者。在此先感謝 – Tai 2011-12-14 17:01:48