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
public void clickSaveData(View view) { todoString = toDoEditText.getText().toString().trim(); // Check Space if (todoString.equals("")) { Toast.makeText(AddToDoList.this, "กรุณากรอกช่องว่าง", Toast.LENGTH_SHORT).show(); } else { // Have Data ManageTABLE objManageTABLE = new ManageTABLE(this); objManageTABLE.addToDoList(showDateString, todoString); Toast.makeText(AddToDoList.this, "บันทึกข้อมูลเสร็จแล้ว", Toast.LENGTH_SHORT).show(); finish(); } } // clickSaveData
private void testAddValue() { ManageTABLE objManageTABLE = new ManageTABLE(this); objManageTABLE.addNewValue( "user", "history", "used", "Allerties", "Resistance", "MyDrug", "Alert"); }