List of usage examples for android.widget TimePicker getCurrentMinute
@NonNull
@Deprecated
public Integer getCurrentMinute()
From source file:de.androvdr.activities.ChannelsActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_WHATS_ON: final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.extendedchannels_whats_on); dialog.setTitle(R.string.channels_whats_on); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); final DatePicker dp = (DatePicker) dialog.findViewById(R.id.channels_datePicker); final TimePicker tp = (TimePicker) dialog.findViewById(R.id.channels_timePicker); tp.setIs24HourView(DateFormat.is24HourFormat(getApplicationContext())); if (sp.contains("whats_on_hour")) { tp.setCurrentHour(sp.getInt("whats_on_hour", 0)); tp.setCurrentMinute(sp.getInt("whats_on_minute", 0)); }// w w w . j a v a2 s. com Button button = (Button) dialog.findViewById(R.id.channels_cancel); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); button = (Button) dialog.findViewById(R.id.channels_search); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Editor editor = sp.edit(); editor.putInt("whats_on_hour", tp.getCurrentHour()); editor.putInt("whats_on_minute", tp.getCurrentMinute()); editor.commit(); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy hh:mm"); try { long time = df.parse(dp.getDayOfMonth() + "." + (dp.getMonth() + 1) + "." + dp.getYear() + " " + tp.getCurrentHour() + ":" + tp.getCurrentMinute()).getTime() / 1000; getController().whatsOn(time); } catch (ParseException e) { logger.error("Couldn't get date from pickers", e); } dialog.dismiss(); } }); return dialog; default: return super.onCreateDialog(id); } }
From source file:reportsas.com.formulapp.Formulario.java
public int ObtenerRespuesta(LinearLayout contenedor, Pregunta Pregunta, ArrayList<PreguntaRespuesta> respuestaList) { PreguntaRespuesta result = new PreguntaRespuesta(); int numRespuesta = 0; result.setIdPregunta(Pregunta.getIdPregunta()); EditText resp;/*from w w w . j a v a 2 s. c o m*/ TextView selectio; switch (Pregunta.getTipoPregunta()) { case 1: resp = (EditText) contenedor.findViewById(R.id.edtTexto); result.setItem(1); result.setRespuesta(resp.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 2: resp = (EditText) contenedor.findViewById(R.id.mtxtEdit); result.setItem(1); result.setRespuesta(resp.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 3: selectio = (TextView) contenedor.findViewById(R.id.respuestaGruop); result.setItem(1); result.setRespuesta(selectio.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 4: String resp_opcio = ""; for (int j = 0; j < contenedor.getChildCount(); j++) { View child = contenedor.getChildAt(j); if (child instanceof CheckBox) { CheckBox hijo = (CheckBox) child; if (hijo.isChecked()) { if (resp_opcio.length() == 0) { if (Pregunta.isOpcionEditble(hijo.getText().toString())) { EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto); resp_opcio = otrosR.getText().toString(); } else { resp_opcio = hijo.getText().toString(); } } else { if (Pregunta.isOpcionEditble(hijo.getText().toString())) { EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto); resp_opcio += " , " + otrosR.getText().toString() + " "; } else { resp_opcio = resp_opcio + " , " + hijo.getText() + " "; } } } } } result.setItem(1); result.setRespuesta(resp_opcio); respuestaList.add(result); numRespuesta = 1; break; case 5: selectio = (TextView) contenedor.findViewById(R.id.seleEscala); result.setItem(1); result.setRespuesta(selectio.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 6: Spinner lista = (Spinner) contenedor.findViewById(R.id.opcionesListado); result.setItem(1); result.setRespuesta(lista.getSelectedItem().toString() + ""); respuestaList.add(result); numRespuesta = 1; break; case 7: TableLayout tabla = (TableLayout) contenedor.findViewById(R.id.tablaOpciones); for (int i = 0; i < tabla.getChildCount(); i++) { TableRow registro = (TableRow) tabla.getChildAt(i); TextView etiq = (TextView) registro.findViewById(R.id.textoRow); RadioGroup selector = (RadioGroup) registro.findViewById(R.id.valoresRow); PreguntaRespuesta itemA = new PreguntaRespuesta(); itemA.setIdPregunta(Pregunta.getIdPregunta()); itemA.setItem(i + 1); itemA.setRespuesta(etiq.getText().toString()); if (selector.getCheckedRadioButtonId() > 0) { RadioButton rb = (RadioButton) selector.findViewById(selector.getCheckedRadioButtonId()); itemA.setOpcion(rb.getText() + ""); } respuestaList.add(itemA); numRespuesta++; } break; case 8: DatePicker dp = (DatePicker) contenedor.findViewById(R.id.Fecha_resutl); result.setItem(1); result.setRespuesta(dp.getYear() + "-" + dp.getMonth() + "-" + dp.getDayOfMonth()); respuestaList.add(result); numRespuesta = 1; break; case 9: TimePicker tp = (TimePicker) contenedor.findViewById(R.id.hora_result); result.setItem(1); result.setRespuesta(tp.getCurrentHour() + ":" + tp.getCurrentMinute()); respuestaList.add(result); numRespuesta = 1; break; default: result.setItem(1); result.setRespuesta("Proceso"); break; } return numRespuesta; }
From source file:com.roque.rueda.cashflows.fragments.AddMovementFragment.java
/** * Create a date time dialog to allow the user choose the date for the movement. * *///from w w w. j a v a2 s . c o m private void createDateTimeDialog() { // Add a listener to display a dialog when the user taps on this view. mDateText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Set the current date if it's one the saved instance object. final Calendar c = Calendar.getInstance(); c.setTimeInMillis(mCurrentDate); // Dialog settings. AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), AlertDialog.THEME_HOLO_DARK); LayoutInflater layoutInflater = getActivity().getLayoutInflater(); builder.setTitle(R.string.time_date_dialog_title); // Custom view used to display date picker and time picker. View dateTimeLayout = layoutInflater.inflate(R.layout.date_time_layout, null); // Text used to display the selected date. final TextView selectedDate = (TextView) dateTimeLayout.findViewById(R.id.selected_date); final Date selectedDateByUser = new Date(getInputDate()); selectedDate.setText(StringFormatter.formatDate(selectedDateByUser)); final DatePicker datePicker = (DatePicker) dateTimeLayout.findViewById(R.id.date_picker); final TimePicker timePicker = (TimePicker) dateTimeLayout.findViewById(R.id.time_picker); Calendar calendar = Calendar.getInstance(); calendar.setTime(selectedDateByUser); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); int hourOfTheDay = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); timePicker.setCurrentHour(hourOfTheDay); timePicker.setCurrentMinute(minute); // Initialize the date picker, also add a listener to // update the label when user change the values. datePicker.init(year, month, day, new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, monthOfYear); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute()); calendar.set(Calendar.SECOND, 0); Date modifyDate = calendar.getTime(); // Update the text view. selectedDate.setText(StringFormatter.formatDate(modifyDate)); } }); // Listener used to update the values when time is selected. timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() { @Override public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, datePicker.getYear()); calendar.set(Calendar.MONTH, datePicker.getMonth()); calendar.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth()); calendar.set(Calendar.HOUR_OF_DAY, hourOfDay); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.SECOND, 0); Date modifyDate = calendar.getTime(); // Update the text view. selectedDate.setText(StringFormatter.formatDate(modifyDate)); } }); // Set the view to the dialog. builder.setView(dateTimeLayout); // Accept button behaviour. builder.setPositiveButton(R.string.accept, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Calendar dialogDate = Calendar.getInstance(); dialogDate.set(Calendar.YEAR, datePicker.getYear()); dialogDate.set(Calendar.MONTH, datePicker.getMonth()); dialogDate.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth()); dialogDate.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour()); dialogDate.set(Calendar.MINUTE, timePicker.getCurrentMinute()); dialogDate.set(Calendar.SECOND, 0); setCurrentDateText(dialogDate.getTime()); dialog.dismiss(); } }); // Cancel button behaviour. builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Create and display the dialog. Dialog dateDialog = builder.create(); dateDialog.show(); } }); }
From source file:net.czlee.debatekeeper.DebatingActivity.java
/** * Finishes editing the current time and restores the GUI to its prior state. * @param save true if the edited time should become the new current time, false if it should * be discarded.//from www. j av a 2 s . c om */ private void editCurrentTimeFinish(boolean save) { TimePicker currentTimePicker = (TimePicker) mDebateTimerDisplay .findViewById(R.id.debateTimer_currentTimePicker); if (currentTimePicker == null) { Log.e(TAG, "editCurrentTimeFinish: currentTimePicker was null"); return; } currentTimePicker.clearFocus(); // Hide the keyboard InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(currentTimePicker.getWindowToken(), 0); if (save && mDebateManager != null && mIsEditingTime) { // We're using this in hours and minutes, not minutes and seconds int minutes = currentTimePicker.getCurrentHour(); int seconds = currentTimePicker.getCurrentMinute(); long newTime = minutes * 60 + seconds; // Invert the time if in count-down mode newTime = subtractFromSpeechLengthIfCountingDown(newTime); mDebateManager.setActivePhaseCurrentTime(newTime); } mIsEditingTime = false; updateGui(); }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
private void updateTvData() { if (!TvDataUpdateService.IS_RUNNING) { Cursor test = getContentResolver().query(TvBrowserContentProvider.CONTENT_URI_CHANNELS, null, TvBrowserContentProvider.CHANNEL_KEY_SELECTION + "=1", null, null); if (test.getCount() > 0) { AlertDialog.Builder builder = new AlertDialog.Builder(TvBrowser.this); RelativeLayout dataDownload = (RelativeLayout) getLayoutInflater() .inflate(R.layout.dialog_data_update_selection, getParentViewGroup(), false); final Spinner days = (Spinner) dataDownload .findViewById(R.id.dialog_data_update_selection_download_days); final CheckBox pictures = (CheckBox) dataDownload .findViewById(R.id.dialog_data_update_selection_download_picture); final Spinner autoUpdate = (Spinner) dataDownload .findViewById(R.id.dialog_data_update_preferences_auto_update_selection_type); final Spinner frequency = (Spinner) dataDownload .findViewById(R.id.dialog_data_update_preferences_auto_update_selection_frequency); final CheckBox onlyWiFi = (CheckBox) dataDownload .findViewById(R.id.dialog_data_update_preferences_auto_update_selection_type_connection); final TextView timeLabel = (TextView) dataDownload .findViewById(R.id.dialog_data_update_preferences_auto_update_selection_time_label); final TextView time = (TextView) dataDownload .findViewById(R.id.dialog_data_update_preferences_auto_update_selection_time); time.setTextColor(onlyWiFi.getTextColors()); String currentDownloadDays = PrefUtils.getStringValue(R.string.DAYS_TO_DOWNLOAD, R.string.days_to_download_default); final String[] possibleDownloadDays = getResources().getStringArray(R.array.download_days); for (int i = 0; i < possibleDownloadDays.length; i++) { if (currentDownloadDays.equals(possibleDownloadDays[i])) { days.setSelection(i); break; }/*from w ww . j a v a 2 s .c o m*/ } pictures.setChecked( PrefUtils.getBooleanValue(R.string.LOAD_PICTURE_DATA, R.bool.load_picture_data_default)); String currentAutoUpdateValue = PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default); String currentAutoUpdateFrequency = PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_FREQUENCY, R.string.pref_auto_update_frequency_default); if (currentAutoUpdateValue.equals("0")) { frequency.setEnabled(false); onlyWiFi.setEnabled(false); timeLabel.setEnabled(false); time.setEnabled(false); frequency.setVisibility(View.GONE); onlyWiFi.setVisibility(View.GONE); timeLabel.setVisibility(View.GONE); time.setVisibility(View.GONE); } else if (currentAutoUpdateValue.equals("1")) { autoUpdate.setSelection(1); timeLabel.setEnabled(false); time.setEnabled(false); timeLabel.setVisibility(View.GONE); time.setVisibility(View.GONE); } else if (currentAutoUpdateValue.equals("2")) { autoUpdate.setSelection(2); } final String[] autoFrequencyPossibleValues = getResources() .getStringArray(R.array.pref_auto_update_frequency_values); for (int i = 0; i < autoFrequencyPossibleValues.length; i++) { if (autoFrequencyPossibleValues[i].equals(currentAutoUpdateFrequency)) { frequency.setSelection(i); break; } } onlyWiFi.setChecked(PrefUtils.getBooleanValue(R.string.PREF_AUTO_UPDATE_ONLY_WIFI, R.bool.pref_auto_update_only_wifi_default)); final AtomicInteger currentAutoUpdateTime = new AtomicInteger(PrefUtils.getIntValue( R.string.PREF_AUTO_UPDATE_START_TIME, R.integer.pref_auto_update_start_time_default)); Calendar now = Calendar.getInstance(); now.set(Calendar.HOUR_OF_DAY, currentAutoUpdateTime.get() / 60); now.set(Calendar.MINUTE, currentAutoUpdateTime.get() % 60); now.set(Calendar.SECOND, 0); now.set(Calendar.MILLISECOND, 0); time.setText(DateFormat.getTimeFormat(TvBrowser.this).format(now.getTime())); autoUpdate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { frequency.setEnabled(position != 0); onlyWiFi.setEnabled(position != 0); if (position != 0) { frequency.setVisibility(View.VISIBLE); onlyWiFi.setVisibility(View.VISIBLE); } else { frequency.setVisibility(View.GONE); onlyWiFi.setVisibility(View.GONE); } timeLabel.setEnabled(position == 2); time.setEnabled(position == 2); if (position == 2) { timeLabel.setVisibility(View.VISIBLE); time.setVisibility(View.VISIBLE); } else { timeLabel.setVisibility(View.GONE); time.setVisibility(View.GONE); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder b2 = new AlertDialog.Builder(TvBrowser.this); LinearLayout timeSelection = (LinearLayout) getLayoutInflater().inflate( R.layout.dialog_data_update_selection_auto_update_time, getParentViewGroup(), false); final TimePicker timePick = (TimePicker) timeSelection .findViewById(R.id.dialog_data_update_selection_auto_update_selection_time); timePick.setIs24HourView(DateFormat.is24HourFormat(TvBrowser.this)); timePick.setCurrentHour(currentAutoUpdateTime.get() / 60); timePick.setCurrentMinute(currentAutoUpdateTime.get() % 60); b2.setView(timeSelection); b2.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { currentAutoUpdateTime .set(timePick.getCurrentHour() * 60 + timePick.getCurrentMinute()); Calendar now = Calendar.getInstance(); now.set(Calendar.HOUR_OF_DAY, currentAutoUpdateTime.get() / 60); now.set(Calendar.MINUTE, currentAutoUpdateTime.get() % 60); now.set(Calendar.SECOND, 0); now.set(Calendar.MILLISECOND, 0); time.setText(DateFormat.getTimeFormat(TvBrowser.this).format(now.getTime())); } }); b2.setNegativeButton(android.R.string.cancel, null); b2.show(); } }; time.setOnClickListener(onClickListener); timeLabel.setOnClickListener(onClickListener); builder.setTitle(R.string.download_data); builder.setView(dataDownload); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String value = possibleDownloadDays[days.getSelectedItemPosition()]; Editor settings = PreferenceManager.getDefaultSharedPreferences(TvBrowser.this).edit(); if (PrefUtils.getStringValueAsInt(R.string.PREF_AUTO_UPDATE_RANGE, R.string.pref_auto_update_range_default) < Integer.parseInt(value)) { settings.putString(getString(R.string.PREF_AUTO_UPDATE_RANGE), value); } settings.putString(getString(R.string.DAYS_TO_DOWNLOAD), value); settings.putBoolean(getString(R.string.LOAD_PICTURE_DATA), pictures.isChecked()); settings.putString(getString(R.string.PREF_AUTO_UPDATE_TYPE), String.valueOf(autoUpdate.getSelectedItemPosition())); if (autoUpdate.getSelectedItemPosition() == 1 || autoUpdate.getSelectedItemPosition() == 2) { settings.putString(getString(R.string.PREF_AUTO_UPDATE_FREQUENCY), autoFrequencyPossibleValues[frequency.getSelectedItemPosition()]); settings.putBoolean(getString(R.string.PREF_AUTO_UPDATE_ONLY_WIFI), onlyWiFi.isChecked()); if (autoUpdate.getSelectedItemPosition() == 2) { settings.putInt(getString(R.string.PREF_AUTO_UPDATE_START_TIME), currentAutoUpdateTime.get()); } } settings.commit(); IOUtils.handleDataUpdatePreferences(TvBrowser.this); Intent startDownload = new Intent(TvBrowser.this, TvDataUpdateService.class); startDownload.putExtra(TvDataUpdateService.TYPE, TvDataUpdateService.TV_DATA_TYPE); startDownload.putExtra(getResources().getString(R.string.DAYS_TO_DOWNLOAD), Integer.parseInt(value)); startService(startDownload); updateProgressIcon(true); } }); builder.setNegativeButton(android.R.string.cancel, null); builder.show(); } else { Cursor test2 = getContentResolver().query(TvBrowserContentProvider.CONTENT_URI_CHANNELS, null, null, null, null); boolean loadAgain = test2.getCount() < 1; test2.close(); selectChannels(loadAgain); } test.close(); } }
From source file:course1778.mobileapp.safeMedicare.Main.FamMemFrag.java
public void onClick(DialogInterface di, int whichButton) { // get strings from edittext boxes, then insert them into database ContentValues values = new ContentValues(DatabaseHelper.CONTENT_VALUE_COUNT); ContentValues drugInteractionValues = new ContentValues(4); Dialog dlg = (Dialog) di; EditText title = (EditText) dlg.findViewById(R.id.title); TimePicker tp = (TimePicker) dlg.findViewById(R.id.timePicker); Spinner mySpinner = (Spinner) dlg.findViewById(R.id.spinner); String fre = mySpinner.getSelectedItem().toString(); EditText dosage = (EditText) dlg.findViewById(R.id.dosage); EditText instruction = (EditText) dlg.findViewById(R.id.instruction); RadioGroup radioButtonGroup = (RadioGroup) dlg.findViewById(R.id.radioGroup); int radioButtonID = radioButtonGroup.getCheckedRadioButtonId(); View radioButton = radioButtonGroup.findViewById(radioButtonID); int shape = radioButtonGroup.indexOfChild(radioButton) / 2; int Fre;//from w w w .j av a2 s.c o m //int day = 0; int monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0, sunday = 0; // clear array list drug_interaction_list.clear(); curr_drug_interaction_list.clear(); // loop through database crsInteractions.moveToPosition(-1); while (crsInteractions.moveToNext()) { // drug names drugName = crsInteractions.getString(crsInteractions.getColumnIndex(DatabaseHelper.SHEET_1_DRUG_NAMES)); // corresponding interacted drugs/foods interactionName = crsInteractions .getString(crsInteractions.getColumnIndex(DatabaseHelper.SHEET_1_DRUG_INTERACTIONS)); // interaction result interactionResult = crsInteractions .getString(crsInteractions.getColumnIndex(DatabaseHelper.SHEET_1_INTERACTION_RESULT)); // medication name entered by user medNameFieldTxt = textView.getText().toString(); // check if newly entered medication name matches current drug name if (drugName.equals(medNameFieldTxt)) { /**if found, check if the corresponding interaction * drug in the list of all added drugs by user */ if (db.isNameExitOnDB(interactionName)) { // interaction found Log.d("myinteraction", "Found Interaction"); String interaction_result = medNameFieldTxt + "/" + interactionName + "\n"; // only insert new drug interactions if they have not yet exist if (!dbInteraction.isDrugInteractionExist(medNameFieldTxt, interactionName)) { // insert the drug interaction into our new dynamic drug interaction db drugInteractionValues.put(DatabaseInteractionHelper.USR_NAME, ParseUser.getCurrentUser().getUsername()); drugInteractionValues.put(DatabaseInteractionHelper.DRUG_NAME, medNameFieldTxt); drugInteractionValues.put(DatabaseInteractionHelper.DRUG_INTERACTION, interactionName); drugInteractionValues.put(DatabaseInteractionHelper.DRUG_INTERACTION_SHOW, DatabaseInteractionHelper.DRUG_INTERACTION_SHOW_TRUE); dbInteraction.getWritableDatabase().insert(DatabaseInteractionHelper.TABLE, DatabaseInteractionHelper.DRUG_NAME, drugInteractionValues); } drug_interaction_list.add(interaction_result); curr_drug_interaction_list.add(interactionName); } } } Log.d("mydatabase3", DatabaseUtils.dumpCursorToString(dbInteraction.getCursor())); // display all iteractions in pop window if there is any String interaction_results = "\n"; for (int i = 0; i < curr_drug_interaction_list.size(); i++) { String interaction = medNameFieldTxt + " & " + curr_drug_interaction_list.get(i) + "\n\n"; interaction_results = interaction_results.concat(interaction); } if (drug_interaction_list.size() != 0) { // inflate a dialog to display the drug interactions warning LayoutInflater inflater = getActivity().getLayoutInflater(); View resultView = inflater.inflate(R.layout.drug_interaction_result, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.drug_interaction_result_title).setView(resultView) // go to drug interaction list button .setNegativeButton(R.string.drug_interaction_list, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // drug interaction page DrugInteractions drugInterac = new DrugInteractions(); FragmentTransaction transaction; transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragmentContainer, drugInterac); transaction.addToBackStack(null); // Commit the transaction transaction.commit(); } }) // ok button .setPositiveButton(R.string.dismiss, null).show(); TextView interactionResultView = (TextView) resultView.findViewById(R.id.resultView); // add warning message into the pop up window interaction_results = interaction_results.concat(getString(R.string.interaction_warning)); // display on pop up window interactionResultView.setText(interaction_results); } // write the list of drug interactions into file Helpers.writeToFile(getContext(), drug_interaction_list, "drug_interaction_list"); Log.d("mydatabase", DatabaseUtils.dumpCursorToString(db.getCursor())); if (fre == "Ten Times a Day") { Fre = 10; } else if (fre == "Twice a Day") { Fre = 2; } else if (fre == "Three Times a Day") { Fre = 3; } else if (fre == "Four Times a Day") { Fre = 4; } else if (fre == "Five Times a Day") { Fre = 5; } else if (fre == "Six Times a Day") { Fre = 6; } else if (fre == "Seven Times a Day") { Fre = 7; } else if (fre == "Eight Times a Day") { Fre = 8; } else if (fre == "Nine Times a Day") { Fre = 9; } else { Fre = 1; } if (((CheckBox) dlg.findViewById(R.id.MonCheck)).isChecked()) { monday = monday + 1; } if (((CheckBox) dlg.findViewById(R.id.TueCheck)).isChecked()) { tuesday = tuesday + 1; } if (((CheckBox) dlg.findViewById(R.id.WedCheck)).isChecked()) { wednesday = wednesday + 1; } if (((CheckBox) dlg.findViewById(R.id.ThuCheck)).isChecked()) { thursday = thursday + 1; } if (((CheckBox) dlg.findViewById(R.id.FriCheck)).isChecked()) { friday = friday + 1; } if (((CheckBox) dlg.findViewById(R.id.SatCheck)).isChecked()) { saturday = saturday + 1; } if (((CheckBox) dlg.findViewById(R.id.SunCheck)).isChecked()) { sunday = sunday + 1; } // clear focus before retrieving the min and hr tp.clearFocus(); int tpMinute = tp.getCurrentMinute(); int tpHour = tp.getCurrentHour(); // an order number to order the list view items int orderNum = tpHour * 60 + tpMinute; tp.setIs24HourView(true); String titleStr = title.getText().toString(); String timeHStr = Helpers.StringFormatter(tpHour, "00"); String timeMStr = Helpers.StringFormatter(tpMinute, "00"); String dosageStr = dosage.getText().toString(); String instructionStr = instruction.getText().toString(); Log.d("mytime", Integer.toString(tpHour)); Log.d("mytime", Integer.toString(tpMinute)); values.put(DatabaseHelper.USRNAME, ParseUser.getCurrentUser().getUsername()); values.put(DatabaseHelper.TITLE, titleStr); values.put(DatabaseHelper.TIME_H, timeHStr); values.put(DatabaseHelper.TIME_M, timeMStr); values.put(DatabaseHelper.FREQUENCY, Fre); //values.put(DatabaseHelper.DAY, day); values.put(DatabaseHelper.MONDAY, monday); values.put(DatabaseHelper.TUESDAY, tuesday); values.put(DatabaseHelper.WEDNESDAY, wednesday); values.put(DatabaseHelper.THURSDAY, thursday); values.put(DatabaseHelper.FRIDAY, friday); values.put(DatabaseHelper.SATURDAY, saturday); values.put(DatabaseHelper.SUNDAY, sunday); values.put(DatabaseHelper.DOSAGE, dosageStr); values.put(DatabaseHelper.INSTRUCTION, instructionStr); values.put(DatabaseHelper.SHAPE, shape); values.put(DatabaseHelper.ORDER_NUM, orderNum); Bundle bundle = new Bundle(); // add extras here.. bundle.putString(DatabaseHelper.TITLE, title.getText().toString()); bundle.putString(DatabaseHelper.TIME_H, timeHStr); bundle.putString(DatabaseHelper.TIME_M, timeMStr); bundle.putInt(DatabaseHelper.FREQUENCY, Fre); //bundle.putInt(DatabaseHelper.DAY, day); bundle.putInt(DatabaseHelper.MONDAY, monday); bundle.putInt(DatabaseHelper.TUESDAY, tuesday); bundle.putInt(DatabaseHelper.WEDNESDAY, wednesday); bundle.putInt(DatabaseHelper.THURSDAY, thursday); bundle.putInt(DatabaseHelper.FRIDAY, friday); bundle.putInt(DatabaseHelper.SATURDAY, saturday); bundle.putInt(DatabaseHelper.SUNDAY, sunday); bundle.putString(DatabaseHelper.DOSAGE, dosageStr); bundle.putString(DatabaseHelper.INSTRUCTION, instructionStr); bundle.putInt(DatabaseHelper.SHAPE, shape); bundle.putInt(DatabaseHelper.ORDER_NUM, orderNum); //Alarm alarm = new Alarm(getActivity().getApplicationContext(), bundle); // get unique notifyId for each alarm int length = title.length(); for (int i = 0; i < length; i++) { notifyId = (int) titleStr.charAt(i) + notifyId; } notifyId = Integer.parseInt(timeHStr + timeMStr); // saving it into parse.com ParseObject parseObject = new ParseObject(Helpers.PARSE_OBJECT); parseObject.put(DatabaseHelper.USRNAME, ParseUser.getCurrentUser().getUsername()); parseObject.put(DatabaseHelper.TITLE, titleStr); parseObject.put(DatabaseHelper.TIME_H, timeHStr); parseObject.put(DatabaseHelper.TIME_M, timeMStr); parseObject.put(DatabaseHelper.FREQUENCY, Fre); //parseObject.put(DatabaseHelper.DAY, day); parseObject.put(DatabaseHelper.MONDAY, monday); parseObject.put(DatabaseHelper.TUESDAY, tuesday); parseObject.put(DatabaseHelper.WEDNESDAY, wednesday); parseObject.put(DatabaseHelper.THURSDAY, thursday); parseObject.put(DatabaseHelper.FRIDAY, friday); parseObject.put(DatabaseHelper.SATURDAY, saturday); parseObject.put(DatabaseHelper.SUNDAY, sunday); parseObject.put(DatabaseHelper.DOSAGE, dosageStr); parseObject.put(DatabaseHelper.INSTRUCTION, instructionStr); parseObject.put(DatabaseHelper.SHAPE, shape); parseObject.put(DatabaseHelper.NOFITY_ID, notifyId); parseObject.put(DatabaseHelper.ORDER_NUM, orderNum); parseObject.saveInBackground(); task = new InsertTask().execute(values); }