如何将回调从活动传递到片段

In documentation is described method passing data from fragment to activity (https://developer.android.com/training/basics/fragments/communicating.html). I have opposite case I need pass data from activity to fragment. What is the best way setting callback to activity from fragment? I use (activity as MainActivity).setCallback(this) in a fragment and it works.