0

List data is to be displayed in a RecyclerView, and a graphical view at the same time. It is my understanding that separate adapters would be required for each.

My issue is

  • I've been struggling with where to load persistent data and hold it at runtime.
  • Loading and holding the data in separate adapters means loading the same data twice from persistent storage. Although some might be cached, it is still effectively loaded twice.
  • How to trigger update of both views when the data is changed, say from an activity launched from click on the list view?
  • The views should not need to know about the existence of each other.

Maybe the simple(?) solution is to wrap the list in a class, which handles the data loading, giving it an interface for listeners (the adapters) to subscribe to, and add the necessary listener interface, implementation, etc.

I don't mean this to be an opinion oriented question. There should be a common or best practice method. I'm new to android development.

ozzylee
  • 181
  • 1
  • 15
  • This may help you [https://stackoverflow.com/questions/52639428/how-to-pass-data-one-textview-to-another-textview-inside-activity/52639988#52639988][1] – Mittal Varsani Oct 08 '18 at 08:19
  • That does not solve my issue because my views are independent of each other. They should have their own coupling to the data source, and both receive notifications regarding it. Thanks for looking at the issue though. – ozzylee Oct 12 '18 at 07:04

0 Answers0