skip to Main Content

Firebase – Update Kotlin Flow on value change

I'm using this code to get my user from the Firebase Realtime Database in my Android app: private var _user = getUser(firebaseAuth.currentUser?.uid ?: "NULL") .stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null) The idea is that I can get flow updates about the user from…

VIEW QUESTION

When using a nested RecyclerView to retrieve data from Firebase, how can I prevent duplicate data from being fetched?

public class OrderHistoryActivity extends AppCompatActivity { private FirebaseAuth firebaseAuth; private DatabaseReference databaseReference; private RecyclerView parentRecyclerView; private ArrayList<MyOrder> parentModelArrayList; private RecyclerView.Adapter ParentAdapter; private RecyclerView.LayoutManager parentLayoutManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_order_history); firebaseAuth = FirebaseAuth.getInstance(); FirebaseUser firebaseUser = firebaseAuth.getCurrentUser(); databaseReference…

VIEW QUESTION
Back To Top
Search