Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 1.29 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android - Custom Date style - SimpleDateFormat - app crash
  2. <PreferenceCategory android:title="StatusBar Date">
  3.     <CheckBoxPreference android:title="Custom date" android:key="custom_date" android:summary="Turn on to enable custom date format" android:defaultValue="false" />
  4.     <EditTextPreference android:title="Notification bar date format" android:key="custom_format" android:dependency="custom_date" />
  5. </PreferenceCategory>
  6.        
  7. private void updateSettings()
  8.   {
  9.     boolean bool;
  10.     if (Settings.System.getInt(mContext.getContentResolver(), "custom_date", 1) != 1)
  11.       bool = false;
  12.     else
  13.       bool = true;
  14.     mCustomdate = bool;
  15.   }
  16.  
  17.   private String getCustomDateformat()
  18.   {
  19.     return Settings.System.getString(mContext.getContentResolver(), "custom_format");
  20.   }
  21.  
  22.   private final void updateClock()
  23.   {
  24.     Object localObject = new Date();
  25.     getResources();
  26.     if (!mCustomDate)
  27.       localObject = android.text.format.DateFormat.getDateFormat(mContext).format((Date)localObject);
  28.     else
  29.       localObject = new SimpleDateFormat(getCustomDateformat()).format((Date)localObject);
  30.     setText((CharSequence)localObject);
  31.   }
  32.        
  33. java.lang.NullPointerException
  34.  
  35. java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:286)
  36.        
  37. 286        final int patternLength = template.length();