我想经度和纬度的变量传递到了谷歌地图的片段另一项活动。到目前为止,我已经成功地做到这一点。
I am trying to pass longitude and latitude variables into another activity for the Google maps fragment. So far I have managed to do this
Intent i = new Intent(Main.this, Main2.class);
i.putExtra(Double.toString(gettextLong), xLocation.getLongitude());
i.putExtra(Double.toString(gettextLat), xLocation.getLatitude());'
我如何收到的其他活动?
How do I receive it in the other activity?
提供有关类似键
Intent i = new Intent(Main.this, Main2.class);
i.putExtra("longitude", xLocation.getLongitude());
i.putExtra("latitude", xLocation.getLatitude());
和MAIN2活动
Bundle extras = getIntent().getExtras();
if(extras !=null && extras.getDouble("latitude") != null && extras.getDouble("longitude") != null) {
double lat = extras.getDouble("latitude");
double lng = extras.getDouble("longitude");
}