Removes all observers that are tied to the given LifecycleOwner. @param owner The LifecycleOwner scope for the observers to be removed.
(final @NonNull LifecycleOwner owner)
| 257 | * @param owner The {@code LifecycleOwner} scope for the observers to be removed. |
| 258 | */ |
| 259 | @SuppressWarnings("WeakerAccess") |
| 260 | @MainThread |
| 261 | public void removeObservers(final @NonNull LifecycleOwner owner) { |
| 262 | assertMainThread("removeObservers"); |
| 263 | for (Map.Entry<Observer<? super T>, ObserverWrapper> entry : mObservers) { |
| 264 | if (entry.getValue().isAttachedTo(owner)) { |
| 265 | removeObserver(entry.getKey()); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Posts a task to a main thread to set the given value. So if you have a following code |
no test coverage detected