public void onClick(View v) { // TODO: validate that inputs are appropriate ContentValues initialValues = new ContentValues(); initialValues.put( ExpenseContentProvider.DATEINCURRED, DateHelper.makeDateString( dateToday.getYear(), dateToday.getMonth() + 1, dateToday.getDayOfMonth())); initialValues.put(ExpenseContentProvider.EXCHANGE, 1.00); initialValues.put(ExpenseContentProvider.CURRENCY, "CDN"); if (layoutExpenseType.getVisibility() == View.VISIBLE) initialValues.put( ExpenseContentProvider.CATEGORY, spinnerExpenseType.getSelectedItem().toString()); else initialValues.put(ExpenseContentProvider.CATEGORY, txtAddType.getText().toString()); initialValues.put(ExpenseContentProvider.AMOUNT, txtAmount.getText().toString()); getContentResolver().insert(ExpenseContentProvider.CONTENT_URI, initialValues); resetInterface(); }
private String getSelectedDate() { return DateHelper.makeDateString( dateToday.getYear(), dateToday.getMonth() + 1, dateToday.getDayOfMonth()); }
protected void bindTodaysSpend(int year, int month, int dayOfMonth) { double spend = expenseData.getTodaysSpend( getApplicationContext(), DateHelper.makeDateString(year, month, dayOfMonth)); lblTodaysSpendValue.setText(ExpenseContentProvider.MONEY_FORMAT.format(spend)); }