I’m working in a project where I retrieve data from local database using SQLite then I process the data and finally I use the processed data in a calculation method.
The problem is that the code is running asynchronously so when I call the calculation method in the first time it works before the retrieve and processing methods it only works in the second or third run.
I have 4 retrieve methods :
retrieve1();
retrieve2();
retrieve3();
retrieve4();
then I want to process the retrieved data so I have the following methods:
processRetrieve1();
processRetrieve2();
processRetrieve3();
processRetrieve4();
finally I want to call the calculation method:
Calculate();
How can I run this code in the following order?
Retrieve methods -> Processing methods -> Calculating method