-1

I am learning to properly use MVVM, Dagger2 and Firebase on Android using java. I was wondering what would be the best way to do the following:

  1. I need to download a list of data from Firebase once
  2. Use the data in a couple of fragments in one activity.

In order to not repeat the procedure of downloading the data from Firebase when creating every new fragment (or activity). Thank you.

tyrael864
  • 31
  • 4
  • I think this **[article](https://medium.com/firebase-tips-tricks/how-to-inject-a-viewmodel-directly-into-an-activity-when-getting-data-from-firestore-633cf8efe60a)** might help. – Alex Mamo Sep 21 '20 at 08:05

1 Answers1

1

load the data into your main activity and pass it to whatever fragment or activity needs it. Heres how to pass data from activity to fragment: Send data from activity to fragment in Android

Heres how to pass data activity to activity: How do I pass data between Activities in Android application?

Trevor Soare
  • 120
  • 8