コード例 #1
0
ファイル: ProfilePreviewUpdate.java プロジェクト: raufur/PHMS
  private void init() {

    // set the textfield id to the variable.
    et_name = (EditText) findViewById(R.id.viewName);
    et_age = (EditText) findViewById(R.id.viewAge);
    etBloodGroup = (EditText) findViewById(R.id.viewBloodGroup);
    et_weight = (EditText) findViewById(R.id.viewWeight);
    et_height = (EditText) findViewById(R.id.viewHeight);
    et_dateOfBirth = (EditText) findViewById(R.id.viewDOB);
    et_specialNotes = (EditText) findViewById(R.id.viewSpComment);
    btnImage = (ImageView) findViewById(R.id.imageViewCreate);
    updateProfile = (Button) findViewById(R.id.updateProfile);
    updateProfile.setOnClickListener(mCorkyListener);
    // home_btn = (Button) view.findViewById(R.id.buttonHome);

    //
    //		 * get the profile which include all data from database according
    //		 * profileId of the clicked item.

    mDataSource = new ProfileDataSource(this);
    mUpdateProfile = mDataSource.singleProfileData();

    if (mUpdateProfile != null) {
      mName = mUpdateProfile.getName();
      // mAge = mUpdateProfile.getAge();
      mBloodGroup = mUpdateProfile.getBloodGroup();
      mWeight = mUpdateProfile.getWeight();
      mHeight = mUpdateProfile.getHeight();
      mDateOfBirth = mUpdateProfile.getDateOfBirth();
      mSpecialNotes = mUpdateProfile.getSpecialNotes();
      image = mUpdateProfile.getImage();
    }

    // Add the line
    mAge = ageCal2.calAge(mDateOfBirth);

    // set the value of database to the text field.
    et_name.setText(mName);
    et_age.setText(mAge);
    etBloodGroup.setText(mBloodGroup);
    et_weight.setText(mWeight);
    et_height.setText(mHeight);
    et_dateOfBirth.setText(mDateOfBirth);
    et_specialNotes.setText(mSpecialNotes);
    et_dateOfBirth.setOnClickListener(this);
  }