خرید بک لینک

Vote count: 0

The problem is taken from initializing and retrieving data from Firebase, however I will translate this to pseudo in order those who are not familiar could also contribue. Please consider the following code: `

//Given the following API (from Firebase)
MyRemoteDBClass.asyncAuthenticate(initCompletedListener);
MyRemoteDBClass.asyncDataFetch(fetchCompletedListener)
// of course you have to authenticate before fetching the data
Class MyClassA.init()
{ 
    MyRemoteDBClass myRemoteDBClassInstance = new MyRemoteDBClass();
    myRemoteDBClassInstance.asyncAuthenticate(some_listener);
}
// Then somewhere in the app:
Class MyClassB.asyncDataFetch(MyRemoteDBClass myRemoteDBClassInstance){
    myRemoteDBClassInstance.asyncDataFetch(myClassBObject_as_listener) 
}`

The problem is that the calls of ClassA and ClassB are pretty close in timeline and I don't know if I get to call the asyncFetch before or after the init of myRemoteDBClassInstance was already completed.
How can I promise that I get to call myRemoteDBClassInstance.asyncDataFetch method in MyClassB after the init was completed?

asked 26 secs ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 21 تير 1395 ساعت: 13:03

صفحه بندی