final TextView dob = (TextView) findViewById(R.id.TextView_DOB);
DatePickerDialog dateDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
Time dateOfBirth = new Time();
dateOfBirth.set(dayofMonth, monthOfYear, year);
long dtDob = dateOfBirth.toMillis(true);
dob.setText(DateFormat("MMMM dd yyyy", dtDob));
Editor editor = mGameSettings.edit();
editor.putLong(GAME_PREFERENCES_DOB, dtDob);
editor.commit();
}
},0,0,0);
return dateDialog;
在這裏,如何在DatePickerDialog的參數中動態創建的類看到「dob」?當然它沒有範圍呢?爲什麼範圍在作爲參數創建的類上工作?