This is a continuation of a research spawned by the answer to my older, broader question.
Is it correct to use a single Cursor (obtained via CursorLoader) to feed two distinct views, namely:
- ListView via SimpleCursorAdapter
- com.google.android.gms.maps.GoogleMap with Markers?
Results i'm having so far:
- If both views are given the cursor synchronously (i.e.: no other threads involved), than visually all works fine, except that UI is blocked considerably when populating GoogleMap
- If GoogleMap is being populated from Cursor in AsyncTask, then UI becomes responsive, but there're anomalies with the ListView: some rows are duplicated, also some markers are not getting to the map.
Details of my setup
- SQLite Cursor is loaded in FragmentActivity during onResume()
- The above activity hosts ViewPager with two fragments: ListFragment and SupportMapFragment (The consequence of using ViewPager is that both fragments will always be active)
- Cursor from activity is delivered to fragments via Otto bus (for unfamiliar: this is merely a thin replacement for callback interfaces, that delivers results synchronously on the main thread)