private void loadUserDOB() {
    DatePicker.OnDateChangedListener onDateChanged =
        new DatePicker.OnDateChangedListener() {
          @Override
          public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            Log.v(
                Globals.TAG,
                "year : "
                    + year
                    + ", monthOfYear : "
                    + monthOfYear
                    + ", dayOfMonth : "
                    + dayOfMonth);
          }
        };

    if (null != user.getDateOfBirth()) {
      String dob[] = user.getDateOfBirth().split("-");
      year = Integer.parseInt(dob[0]);
      month = Integer.parseInt(dob[1]);
      day = Integer.parseInt(dob[2]);

    } else {
      Calendar c = Calendar.getInstance();
      year = c.get(Calendar.YEAR);
      month = c.get(Calendar.MONTH);
      day = c.get(Calendar.DAY_OF_MONTH);
    }

    pickerDOB.init(year, month, day, onDateChanged);
    pickerDOB.setCalendarViewShown(false);
    pickerDOB.setSpinnersShown(true);
  }
  @Override
  protected void onResume() {
    super.onResume();

    btnUpdateProfile.setOnClickListener(this);

    txtInputLastName.addTextChangedListener(new UpdateProfileFormTextWatcher(txtInputLastName));
    txtInputFirstName.addTextChangedListener(new UpdateProfileFormTextWatcher(txtInputFirstName));
    txtInputPhoneNumber.addTextChangedListener(
        new UpdateProfileFormTextWatcher(txtInputPhoneNumber));
    txtInputConfirmPassword.addTextChangedListener(
        new UpdateProfileFormTextWatcher(txtInputConfirmPassword));

    loadInsuranceProvider();
    loadUserDOB();
    loadUserHeight();
    loadUserWeight();

    lastName = user.getLastName();
    firstName = user.getFirstName();
    phoneNumber = user.getPhoneNumber();

    if (null != lastName) {
      txtInputLastName.setText(lastName);
    }

    if (null != firstName) {
      txtInputFirstName.setText(firstName);
    }

    if (null != phoneNumber) {
      txtInputPhoneNumber.setText(phoneNumber);
    }
  }
  private int indexOfUserInsuranceProvider() {
    insuranceProvider = user.getInsuranceProvider();

    if (null != insuranceProvider) {
      return insuranceProviders.indexOf(insuranceProvider);
    }

    return -1;
  }
  private void loadUserHeight() {
    if (null != user.getHeight()) {
      String height[] = user.getHeight().split("-");
      heightFeet = Integer.parseInt(height[0]);
      heightInch = Integer.parseInt(height[1]);
    } else {
      heightFeet = Globals.DEFAULT_HEIGHT_FEET;
      heightInch = Globals.DEFAULT_HEIGHT_INCH;
    }

    pickerHeightFeet.setMinValue(Globals.MIN_HEIGHT_FEET);
    pickerHeightFeet.setMaxValue(Globals.MAX_HEIGHT_FEET);
    pickerHeightFeet.setValue(heightFeet);
    pickerHeightFeet.setWrapSelectorWheel(false);

    pickerHeightFeet.setOnValueChangedListener(
        new NumberPicker.OnValueChangeListener() {

          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            isDataChanged = true;
            Log.v(
                Globals.TAG,
                "picker : " + picker + ", oldVal : " + oldVal + ", newVal : " + newVal);
          }
        });

    pickerHeightInch.setMinValue(Globals.MIN_HEIGHT_INCH);
    pickerHeightInch.setMaxValue(Globals.MAX_HEIGHT_INCH);
    pickerHeightInch.setValue(heightInch);
    pickerHeightInch.setWrapSelectorWheel(false);

    pickerHeightInch.setOnValueChangedListener(
        new NumberPicker.OnValueChangeListener() {

          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            isDataChanged = true;
            Log.v(
                Globals.TAG,
                "picker : " + picker + ", oldVal : " + oldVal + ", newVal : " + newVal);
          }
        });
  }
 private void saveUserData() {
   user.setLastName(lastName);
   user.setFirstName(firstName);
   user.setInsuranceProvider(insuranceProvider);
   user.setDateOfBirth(year + "-" + month + "-" + day);
   user.setHeight(heightFeet + "-" + heightInch);
   user.setWeightLbs(weightLbs);
   user.setPhoneNumber(phoneNumber);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_update_profile);

    user = User.getCurrentUser();
    dbConn = DatabaseConnection.getInstance();
    res = getResources();

    Typeface customTypeface = Typeface.createFromAsset(getAssets(), Globals.FONT_ROBOTO_THIN);
    Typeface customBold = Typeface.create(customTypeface, Typeface.BOLD);

    TextView txtLogoUpdateProfile = (TextView) findViewById(R.id.txt_logo_update_profile_title);
    txtLogoUpdateProfile.setTypeface(customBold);

    inputLayoutLastName = (TextInputLayout) findViewById(R.id.input_layout_last_name);
    txtInputLastName = (EditText) findViewById(R.id.txt_input_last_name);
    txtInputLastName.setTypeface(customBold);

    inputLayoutFirstName = (TextInputLayout) findViewById(R.id.input_layout_first_name);
    txtInputFirstName = (EditText) findViewById(R.id.txt_input_first_name);
    txtInputFirstName.setTypeface(customBold);

    //        inputLayoutPhoneNumber = (TextInputLayout)
    // findViewById(R.id.input_layout_phone_number);
    txtInputPhoneNumber = (EditText) findViewById(R.id.txt_input_phone_number);
    txtInputPhoneNumber.setTypeface(customBold);

    inputLayoutConfirmPassword = (TextInputLayout) findViewById(R.id.input_layout_confirm_password);
    txtInputConfirmPassword = (EditText) findViewById(R.id.txt_input_confirm_password);
    txtInputConfirmPassword.setTypeface(customBold);

    spinnerInsuranceProviders = (Spinner) findViewById(R.id.spinner_insurance_providers);
    spinnerInsuranceProviders.setOnItemSelectedListener(this);

    pickerDOB = (DatePicker) findViewById(R.id.picker_dob);
    pickerHeightFeet = (NumberPicker) findViewById(R.id.picker_height_feet);
    pickerHeightInch = (NumberPicker) findViewById(R.id.picker_height_inch);
    pickerWeight = (NumberPicker) findViewById(R.id.picker_weight);

    btnUpdateProfile = (Button) findViewById(R.id.btn_update);
  }
  private void loadUserWeight() {
    weightLbs = user.getWeightLbs();
    if (weightLbs <= 0) {
      weightLbs = Globals.DEFAULT_WEIGHT_LBS;
    }

    pickerWeight.setMinValue(Globals.MIN_WEIGHT_LBS);
    pickerWeight.setMaxValue(Globals.MAX_WEIGHT_LBS);
    pickerWeight.setValue(weightLbs);
    pickerWeight.setWrapSelectorWheel(false);

    pickerWeight.setOnValueChangedListener(
        new NumberPicker.OnValueChangeListener() {

          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            isDataChanged = true;
            Log.v(
                Globals.TAG,
                "picker : " + picker + ", oldVal : " + oldVal + ", newVal : " + newVal);
          }
        });
  }