Mes*_*esh 1 android listview google-maps latitude-longitude android-intent
我收集了不同的纬度和经度.我想知道我是否可以将它们设置为例如(String lat = {"9385853.0094","23123123.234")的数组字符串然后通过意图传递它们以便我可以使用lat/long在new中显示谷歌地图中的位置活动.
例如,您有两个名为Maps.java和Routes.java的类.
使用以下代码传递LatLng
LatLng fromPosition = new LatLng(9385853.0094, 23123123.234 );
LatLng toPosition = new LatLng(11.145315551, 99.333455333);
Bundle args = new Bundle();
args.putParcelable("from_position", fromPosition);
args.putParcelable("to_position", toPosition);
i.putExtra("bundle", args);
Intent i= new Intent(Maps.this, Routes.class);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
在接收端使用以下代码
Bundle bundle = getIntent().getParcelableExtra("bundle");
LatLng fromPosition = bundle.getParcelable("from_position");
LatLng toPosition = bundle.getParcelable("to_position");
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
归档时间: |
|
查看次数: |
4291 次 |
最近记录: |