Reputation: 83
I am confused with the differences between
public Task addOnCompleteListener(OnCompleteListener listener)
and
public Task addOnCompleteListener(Executor executor, OnCompleteListener listener)
in Android.
Attached here with the image of explanation from Firebase documentation.
From the explanation inside the documentation, the only difference between this two method is highlighted in the image. So what is the shared thread pool?
Thank you.
Upvotes: 5
Views: 9684
Reputation: 2506
The difference is, in addOnCompleteListener(OnCompleteListener listener)
the listener will be called on main thread and in addOnCompleteListener(Executor executor, OnCompleteListener listener)
, the Executor determines the thread that will be used to invoke the listener.
For more info, take a look at this great blog post.
Upvotes: 8