Code example for Context

Methods: getSharedPreferences

0
        if (Config.LOGD) Log.d(TAG, "WallpaperService startup");
        mContext = context;
        createFilesDir(); 
        mWallpaperObserver.startWatching();
 
        SharedPreferences preferences = mContext.getSharedPreferences(PREFERENCES,
                    Context.MODE_PRIVATE);
        mWidth = preferences.getInt(HINT_WIDTH, -1);
        mHeight = preferences.getInt(HINT_HEIGHT, -1);
    } 
     
    @Override 
    protected void finalize() throws Throwable { 
        super.finalize(); 
        mWallpaperObserver.stopWatching();
    } 
     
    public void clearWallpaper() { 
        File f = WALLPAPER_FILE;
        if (f.exists()) {
            f.delete();