Code example for Fragment

Methods: onAttach

0
    return frag;
  } 
 
  @Override 
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    cursorListener = (CursorFilesListener) activity;
    accountListener = (AccountFilesListener) activity;
 
  } 
 
  @Override 
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);
  } 
 
  @Override 
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_assets, container, false);