code: private void writeRead() {
  		// Execute on background thread as we don't know how large this is
  		new AsyncTask<Void, Void, Void>() {
  			@Override
  			protected Void doInBackground(Void... params) {
  				// Get editor & basic variables
  				SharedPreferences.Editor editor = mPrefs.edit();
  				int size = readList.size();
  				boolean value;
  
  				editor.putInt("READ_ARRAY_SIZE", size);
  				for(int i = 0, key; i < size; i++) {
  					key = readList.keyAt(i);
  					value = readList.get(key);
  
  					editor.putInt("READ_ARRAY_KEY_" + i, key);
  					editor.putBoolean("READ_ARRAY_VALUE_" + i, value);
  				}
  				editor.commit();
  
  				return null;
  			}
  		}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
  	}
docs: Asynchronously saves read data.