android - how to identify which fragment is clicked in onMapReady method -
i have activity have 2 fragment attach it.both of them show google map.this xml output want achieve want know fragment called in side onmapready method
here setting 2 fragments
gmap = ((supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map)); gmap2 = ((supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map2));
here setting getmapasync both of them
gmap.getmapasync(this); gmap2.getmapasync(this);
now here want know fragment map clicked
@override public void onmapready(googlemap googlemap) { //here want know fragment clicked }
you have add 2 different listeners this:
gmap.getmapasync(new onmapreadycallback() { @override public void onmapready(googlemap googlemap) { } }); } gmap2.getmapasync(new onmapreadycallback() { @override public void onmapready(googlemap googlemap) { } }); }
Comments
Post a Comment