コード例 #1
0
  public void clickSection11(View view) {

    heightString = heightEditText.getText().toString().trim();
    weightString = weightEditText.getText().toString().trim();
    widthString = widthEditText.getText().toString().trim();

    if (heightString.equals("") || weightString.equals("") || widthString.equals("")) {
      // Have Space
      MyAlertDialog objMyAlertDialog = new MyAlertDialog();
      objMyAlertDialog.myDialog(
          Section1Activity.this, R.drawable.icon_question, "มีช่องว่าง", "กรุณากรอกทุกช่อง คะ");

    } else {
      // no Space
      heightADouble = Double.parseDouble(heightString);
      weightADouble = Double.parseDouble(weightString);
      widthADouble = Double.parseDouble(widthString);

      // Intent to Result
      myIntentToResult();
    } // if

    String tag = "section11";
    Log.d(tag, "ageAnInt = " + ageAnInt);
    Log.d(tag, "sexAnInt = " + sexAnInt);
    Log.d(tag, "pressureAnInt = " + pressureAnInt);
    Log.d(tag, "diabetesAnInt = " + diabetesAnInt);
    Log.d(tag, "height = " + heightADouble);
    Log.d(tag, "weight = " + weightADouble);
    Log.d(tag, "width = " + widthADouble);
  } // clickSection11
コード例 #2
0
  public void clickSavePersonal(View view) {

    // Get Value From Edittext
    nameUserString = nameUserEditText.getText().toString().trim();
    historyString = historyEditText.getText().toString().trim();
    usedString = usedEditText.getText().toString().trim();
    allergiesString = allergiesEditText.getText().toString().trim();
    resistanceString = resistanceEditText.getText().toString().trim();
    myDrugString = myDrugEditText.getText().toString().trim();

    // Check Space
    if ((nameUserString.equals("")
        || historyString.equals("")
        || usedString.equals("")
        || allergiesString.equals("")
        || resistanceString.equals("")
        || myDrugString.equals(""))) {

      // ไม่ยอมให้ผ่าน
      MyAlertDialog objMyAlertDialog = new MyAlertDialog();
      objMyAlertDialog.myDialog(PersonalActivity.this, "มีช่องว่าง", "กรอกให้ครบทุกช่อง");

    } else {

      // ผ่านได้
      Calendar objCalendar = Calendar.getInstance();
      int intHr = objCalendar.get(Calendar.HOUR_OF_DAY);
      int intMinus = objCalendar.get(Calendar.MINUTE);

      timeAlertAnInt = intHr + alertAnInt;

      Log.d("drug", "alertHr ==> " + Integer.toString(timeAlertAnInt));

      ManageTABLE objManageTABLE = new ManageTABLE(this);
      objManageTABLE.addNewValue(
          nameUserString,
          historyString,
          usedString,
          allergiesString,
          resistanceString,
          myDrugString,
          Integer.toString(timeAlertAnInt));

      testAlarm(minAlarmAnInt); // Test ==> minAlarmAnInt Real alertAnInt * 60

      Intent objIntent = new Intent(PersonalActivity.this, MainActivity.class);
      startActivity(objIntent);
    } // if
  } // clickSavePersonal