sharib ahmed
sharib ahmed

Reputation: 194

How can I retrieve two different values from firebase realtime database and use outside onDataChange method?

   int percentint=(vdcostint/b1txtaint)*100;

-------vdcostint is a value retrieved from firebase and b1txtaint is another value from different key---

But I am unable to use two values outside onDataChange.

Upvotes: 0

Views: 75

Answers (1)

mayur
mayur

Reputation: 384

The values you obtain inside onDataChange() are not available outside the method. To use the data outside those values you need to call a function from inside of the onDataChange() and do the calculations there.

Upvotes: 1

Related Questions