Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Android - Custom Date style - SimpleDateFormat - app crash
- <PreferenceCategory android:title="StatusBar Date">
- <CheckBoxPreference android:title="Custom date" android:key="custom_date" android:summary="Turn on to enable custom date format" android:defaultValue="false" />
- <EditTextPreference android:title="Notification bar date format" android:key="custom_format" android:dependency="custom_date" />
- </PreferenceCategory>
- private void updateSettings()
- {
- boolean bool;
- if (Settings.System.getInt(mContext.getContentResolver(), "custom_date", 1) != 1)
- bool = false;
- else
- bool = true;
- mCustomdate = bool;
- }
- private String getCustomDateformat()
- {
- return Settings.System.getString(mContext.getContentResolver(), "custom_format");
- }
- private final void updateClock()
- {
- Object localObject = new Date();
- getResources();
- if (!mCustomDate)
- localObject = android.text.format.DateFormat.getDateFormat(mContext).format((Date)localObject);
- else
- localObject = new SimpleDateFormat(getCustomDateformat()).format((Date)localObject);
- setText((CharSequence)localObject);
- }
- java.lang.NullPointerException
- java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:286)
- 286 final int patternLength = template.length();
Advertisement
Add Comment
Please, Sign In to add comment