Code example for Fragment

Methods: onAttach

0
            contract = (T) activity;
        } catch (ClassCastException e) {
            throw new IllegalStateException(activity.getClass().getSimpleName() + " must implement "
                    + getClass().getSimpleName() + "'s contract interface.", e);
        } 
        super.onAttach(activity);
    } 
 
    @Override 
    public void onDetach() { 
        super.onDetach(); 
        contract = null;
    } 
 
    public final T getContract() { 
        return contract;
    } 
 
} 
Connect your IDE to all the code out there  Get Codota for Java