I look on the Internet how to prevent the activity from reloading on orientation change and I did what was suggested and it helped me solve my problem. But then a new problem appeared. In my activity I have some pictures and buttons that are invisible and would appear if a condition is met. But now when I rotate the phone the pictures and buttons appear although the condition is not met. Is there a way to prevent that from happening?
To stop the activity from reloading I added this code in my java file:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
setContentView(R.layout.activity_get_variants);
}
and in the Manifest file:
android:configChanges="keyboardHidden|orientation|screenSize"