Code example for Fragment

Methods: getActivityonCreatesetHasOptionsMenusetRetainInstance

0
	ArrayList<Drink> drinks;
 
	@TargetApi(11) 
	@Override 
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setHasOptionsMenu(true);
		setRetainInstance(true);
		drinks = ((SocialCafeApplication)getActivity().getApplication()).drinks;
		index = getActivity().getIntent().getIntExtra("DRINK_INDEX", -1);
		 
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
		} 
	} 
	 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.order_drink, parent, false);
		getActivity().setTitle(R.string.place_order);
Experience pair programming with AI  Get Codota for Java