you asked about the relationship between activity and the fragment that you reach using the interface:
Your snippet:
public class YourFragment extends Fragment{ private OnListener listener; public interface OnListener { void onChange(); } void initialize( OnListener listener) { this.listener = listener; }
Your activity:
public class yourActivity extends Activity implements yourFragment.OnListener {
hope this helps.
source share