Code example for SharedPreferences.Editor

Methods: apply, putInt

0
        return super.onTouchEvent(event);
    } 
     
    private void updatePrefs() { 
        Editor edit = mSharedPref.edit();
        edit.putInt("preset", mCurrentPreset);
        edit.apply();
    } 
     
    class WallpaperConnection extends IWallpaperConnection.Stub implements ServiceConnection {
        final Intent mIntent;
        IWallpaperService mService;
        IWallpaperEngine mEngine;
        boolean mConnected;
 
        WallpaperConnection(Intent intent) {
            mIntent = intent;
        } 
 
        public boolean connect() { 
            synchronized (this) {