android - Update one Fragment due to changes in another fragment -


the scenario:

i have 2 fragments(each in separate tab) doing work that's related each other. example:

public class extends fragment{ // take user input , calculate geo-location(this works fine) // user can mannually enter location address , geocoder // figures out lat/lng of location. // uses asych task. }  public class b extends fragment{ // google map. based on latitude & longitude // place marker @ location(which provided class a.) // other stuff aswell  } 

the problem:

i want pass location information class b. having trouble updating map marker once finished calculating location in class a. have seen minute app starts class b oncreateview() method runs. put marker functions information. asych task class takes time calculate geolocation , therefore don't have location provide markers method in class b yet. there anyway add marker map once asych task has completed without calling oncreateview() (for class b) in class again?


in other words

can somehow pass location information (for markers method) , therefore drop marker on google map once asych task has completed.

the best way communicate between fragments using listeners , here can find an example how implement that

when asynctask ends can call listener communicate fragmentb , add marker in map


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -