안녕하세요 안드로이드펍 가족님들..
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.custom_insert_household_detail,(ViewGroup) findViewById(R.id.layout_root));
final EditText date = (EditText)layout.findViewById(R.id.date);
date.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(DATE_DIALOG_ID);
// new DatePickerDialog(HouseholdDetailActivity.this, , year, monthOfYear, dayOfMonth)
}
});
private DatePickerDialog.OnDateSetListener mDateSetListener =
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
}
};
@Override
protected Dialog onCreateDialog(int id)
{
switch(id)
{
case DATE_DIALOG_ID:
return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay);
}
return null;
}'
소스를 보시면 alertDiagog에 임플레이트를 생성하여 넣었습니다.
그리고 거기에 edittext를 터치할경우 데이터피커가 뜨고 뜬상태에서 데이터를 입력해서 onDateSet으로
editext에 텍스트로 넣고싶은데
접근하는방법을 모르겠습니다 ㅜㅜ
좋은밤되세요
AlertDialog.Builder aDialog = new AlertDialog.Builder(HouseholdDetailActivity.this);
aDialog.setTitle("");
aDialog.setView(layout);
AlertDialog ad = aDialog.create();
ad.show();