Created
September 14, 2014 23:06
-
-
Save blazmag/bbfd5430ac4a9edff1cb to your computer and use it in GitHub Desktop.
Fragment template with Butterknife + Otto init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleFragment extends Fragment implements View.OnClickListener{ | |
private Activity mActivity; | |
private Context mContext; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View rootView = inflater.inflate(R.layout.fragment_example, container, false); | |
ButterKnife.inject(this,rootView); | |
BusProvider.getInstance().register(this); | |
Bundle arguments = getArguments(); | |
return rootView; | |
} | |
@Override | |
public void onClick(View v) { | |
} | |
@Override | |
public void onAttach(Activity activity) { | |
super.onAttach(activity); | |
Log.i("Example", "OnAttach ExampleFragment called"); | |
mActivity = activity; | |
mContext = activity.getApplicationContext(); | |
} | |
@Override | |
public void onDetach() { | |
super.onDetach(); | |
Log.i("Example", "OnDetach ExampleFragment called"); | |
BusProvider.getInstance().unregister(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment