@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mLocale = getResources().getConfiguration().locale; View rootView = inflater.inflate(R.layout.fragment_sleepchart, container, false); GBDevice device = ((ChartsHost) getHost()).getDevice(); if (device != null) { // TODO: eek, this is device specific! mTargetSteps = MiBandCoordinator.getFitnessGoal(device.getAddress()); } mWeekStepsChart = (BarLineChartBase) rootView.findViewById(R.id.sleepchart); mTodayStepsChart = (PieChart) rootView.findViewById(R.id.sleepchart_pie_light_deep); setupWeekStepsChart(); setupTodayStepsChart(); // refresh immediately instead of use refreshIfVisible(), for perceived performance refresh(); return rootView; }