1.生成实体类
2. 传值页
(new CitySelete()为实体类)
EventBus.getDefault().post(new CitySelete(latitude, longititude));
3. 接收页
// 接收信息
public void onEventMainThread(CitySelete citySelete) {
double 纬度latitude=citySelete.get纬度latitude();
double 经度longititude=citySelete.get经度longititude();
Log.e(TAG, "纬度latitude: "+纬度latitude);
Log.e(TAG, "经度longititude: "+经度longititude);
//将地图移动到定位点
aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(纬度latitude, 经度longititude)));
}
// 注册EventBus
EventBus.getDefault().register(this);
// 取消注册EventBus
EventBus.getDefault().unregister(this);