How to save the visibility of a button

I wanted to know what would be the best way to save the visibility of a button in shared preferences. I have several buttons and I need that some are visible others not according to what is chosen and when re-entering they stay that way