Code example for Fragment

Methods: getActivity, onResume

0
        return contentView;
    } 
 
    @Override 
    public void onResume() { 
        super.onResume(); 
        if (broadcastReceiver == null) {
            broadcastReceiver = new UIBroadcastReceiver(getActivity(), this);
        } 
        broadcastReceiver.attach();
 
        if (contentView != null) {
            contentView.clearFocus();
        } 
        backPressCalled = false;
 
    } 
 
    @Override 
    public void onPause() { 
        contentView = getView();