LiveData remove Observer after first callback
问题 How do I remove the observer after I receive the first result? Below are two code ways I've tried, but they both keep receiving updates even though I have removed the observer. Observer observer = new Observer<DownloadItem>() { @Override public void onChanged(@Nullable DownloadItem downloadItem) { if(downloadItem!= null) { DownloadManager.this.downloadManagerListener.onDownloadManagerFailed(null, "this item already exists"); return; } startDownload(); model.getDownloadByContentId(contentId)