LiveData,how to avoid the first callback when register observer

You could use SingleLiveEvent which won't be triggered as long as the content hasn't changed.

This is recommended by Google, though.


I found a simple solution,check the livedata value before load

@Override
public void onResume() {
    super.onResume();
    if (mainViewModel.increaseTaskList.getValue()==null) {
        Log.d("ZZZ","IncreaseFragment loadTaskAsync");
        mainViewModel.loadIncreasePointTaskList();
    }
}