【发布时间】:2020-03-25 22:49:48
【问题描述】:
我正在尝试传递从 RSS 提要的点击中收集的坐标和标题,我想将它从调试传递到谷歌地图,它确实通过了没有问题我的问题是在地图上显示它。这是带有意图的onclick:
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent in = new Intent(getApplicationContext(), MapsActivity.class);
String georss = ((TextView) view.findViewById(R.id.georss)).getText().toString();
String title = ((TextView) view.findViewById(R.id.title)).getText().toString();
String[] latLng = georss.split(" ");
double lat = Double.parseDouble(latLng[0]);
double lng = Double.parseDouble(latLng[1]);;
LatLng location = new LatLng(lat, lng);
in.putExtra("location", location);
in.putExtra("title", title);
startActivity(in);
}
});
这是创建时的谷歌地图:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
Intent intent = getIntent();
intent.getStringExtra("title");
intent.getStringExtra("location");
我只是不确定如何显示标记,所以当您单击它时,您可以看到标题。
【问题讨论】:
标签: java android google-maps