Code example for Fragment

Methods: getArguments

0
	/** 
	 * 获取布局文件资源ID 
	 * @return 布局文件资源ID 
	 */ 
	private int getLayoutResId(){ 
		Bundle args = getArguments();
		if( args != null ){
			return args.getInt(KEY_LAYOUT_RES);
		}else{ 
			return INVALID_LAYOUT_ID;
		} 
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
		if(layoutResourceId == INVALID_LAYOUT_ID) {
			throw new IllegalArgumentException(String.format(":::::: %s ==> Illegal LayoutResourceId ! ::::::", this.getClass().getSimpleName()));
		} 
		contentView = inflater.inflate(layoutResourceId, null);
		return contentView;
	}