Skip to content

Instantly share code, notes, and snippets.

@burntcookie90
Created September 22, 2014 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burntcookie90/27a1c58d5d08e188e5fd to your computer and use it in GitHub Desktop.
Save burntcookie90/27a1c58d5d08e188e5fd to your computer and use it in GitHub Desktop.
BaseFragment class that handles registration with the event bus
public class BaseFragment extends Fragment {
public BaseFragment() {}
@Override public void onResume() {
super.onResume();
BusProvider.getInstance().register(this);
}
@Override public void onPause() {
super.onPause();
BusProvider.getInstance().unregister(this);
}
protected void refresh(){ }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
TextView textView = new TextView(getActivity());
textView.setText(R.string.hello_blank_fragment);
return textView;
}
protected void showToast(String message){
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment