This is some Code of the LockScreen in android. The dateformat is:
mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
And I set:
mDateFormatString =Settings.System.getString(getContext().getContentResolver(), Settings.System.DATE_FORMAT) ;
Why I can't get Settings.System.DATE_FORMAT in the LockScreen?
private void resetStatusInfo(KeyguardUpdateMonitor updateMonitor) {
mShowingBatteryInfo = updateMonitor.shouldShowBatteryInfo();
mPluggedIn = updateMonitor.isDevicePluggedIn();
mBatteryLevel = updateMonitor.getBatteryLevel();
/* for dual sim, by jing.wang */
mStatus[SimCardID.ID_ZERO.toInt()] = getCurrentStatus(updateMonitor.getSimState());
if (isDualMode) {
mStatus[SimCardID.ID_ONE.toInt()] = getCurrentStatus(updateMonitor.getSimState (SimCardID.ID_ONE));
updateLayout(mStatus[SimCardID.ID_ZERO.toInt()], SimCardID.ID_ZERO, mStatus[SimCardID.ID_ONE.toInt()]);
updateLayout(mStatus[SimCardID.ID_ONE.toInt()], SimCardID.ID_ONE, mStatus[SimCardID.ID_ZERO.toInt()]);
} else {
updateLayout(mStatus[SimCardID.ID_ZERO.toInt()]);
}
refreshBatteryStringAndIcon();
refreshAlarmDisplay();
mTimeFormat = DateFormat.getTimeFormat(getContext());
mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
refreshTimeAndDateDisplay();
updateStatusLines();
}
Edit: I want to modify the lock screen code. And I want to display the dateformat which I set in setting. But now I set the dateformat "dd-MM-yyyy", it can't display in the lock screen. The date display by the format of mDateFormatString.
mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
This is the code of refreshTimeAndDateDisplay.
private void refreshTimeAndDateDisplay() {
mDate.setText(DateFormat.format(mDateFormatString, new Date()));
}