Engine() { super(); prefs = GalleryWallpaper.this.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE); prefs.registerOnSharedPreferenceChangeListener(this); this.onSharedPreferenceChanged(prefs, GalleryWallpaper.SHARED_PREFS_REPLACEIMAGE); this.onSharedPreferenceChanged(prefs, GalleryWallpaper.SHARED_PREFS_SYNC); onSharedPreferenceChanged(prefs, null); backgroundPaint.setFilterBitmap(false); backgroundPaint.setAntiAlias(true); backgroundPaint.setColor(Color.BLACK); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setShadowLayer(5f, 1f, 1f, Color.GRAY); textPaint.setSubpixelText(true); textPaint.setTextAlign(Paint.Align.LEFT); textPaint.setTextSize(18); textPaint.setTypeface(Typeface.MONOSPACE); this.setTouchEventsEnabled(true); if (Build.VERSION.SDK_INT >= 14) { try { // hinting = textPaint.HINTING_ON; int hinting = textPaint.getClass().getField("HINTING_ON").getInt(textPaint); // textPaint.setHinting(hinting); textPaint.getClass().getMethod("setHinting", int.class).invoke(textPaint, hinting); } catch (IllegalAccessException e) { System.err.println(e.toString()); } catch (InvocationTargetException e) { System.err.println(e.toString()); } catch (NoSuchMethodException e) { System.err.println(e.toString()); } catch (NoSuchFieldException e) { System.err.println(e.toString()); } } }