Code example for Fragment

Methods: getActivitygetArgumentsonCreate

    public PersonDetailFragment() { 
    public void onCreate(Bundle savedInstanceState) {
        if (getArguments().containsKey(ARG_ITEM_ID)) {
        	// Should use the contentprovider here ideally 
            mItem = DatabaseHandler.getInstance(getActivity()).getPersonItem(getArguments().getLong(ARG_ITEM_ID));
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_person_detail, container, false);
        if (mItem != null) {
            textFirstName = ((TextView) rootView.findViewById(;
Connect your IDE to all the code out there  Get Codota for Java