Java – How to hide a View forever

How to hide a View forever… here is a solution to the problem.

How to hide a View forever

Can anyone tell me how to always hide a View?

I’m using view.setVisibility(view. GONE); Hide View, but I have to hide View again when I reopen the application. I want the View to always be hidden when the button is clicked until the application data is cleared or uninstalled. Thanks!

Solution

You need to save the state by creating flags in SharedPreference to hide and unhide the View, and create GONE or VISIBLE View based on that flag.

Related Problems and Solutions