private void DialogDatePicker(){
Calendar c = Calendar.getInstance();
int cyear = c.get(Calendar.YEAR);
int cmonth = c.get(Calendar.MONTH);
int cday = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
// onDateSet method
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
pickdate = String.valueOf(year)+ "-"+String.valueOf(monthOfYear+1)+
"-"+String.valueOf(dayOfMonth)+"일 접종완료";
}
};
DatePickerDialog alert = new DatePickerDialog(this, mDateSetListener,
cyear, cmonth, cday);
alert.show();
}
소스상에는 문제가 없는거 같은데
데이터베이스에 picker를 업데이트 시켰을때 이상한 날짜로 db에 저장됩니다.
예를 들어 2015년 10월 20일을 선택하면 갑자기 2017년이 뜨지 않나 요러네요;;
아래는 datedialog를 호출하는 함수입니다
//아이템 클릭시
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.notifyDataSetInvalidated();
DialogDatePicker();
boolean result = vaccinDBOpenHelper.updateColumn(position + 1, pickdate);
if (result) {
listView.setAdapter(adapter);
adapter.notifyDataSetChanged();
adapter.addItem(new VaccinItem(getResources().getDrawable(R.drawable.check_yes)));
} else {
Toast.makeText(getApplicationContext(), "INDEX를 확인해 주세요.",
Toast.LENGTH_LONG).show();
}
}
});
}
뭐가 문제일까요...??ㅜㅜㅜㅜ