- // Set the form data status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- if (formDataEnabledInt == 1) { // Form data is on.
- formDataEnabledSwitch.setChecked(true);
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
- } else { // Form data is off.
- // Turn the form data switch to off.
- formDataEnabledSwitch.setChecked(false);
+ // Set the form data status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. Form data can be removed once the minimum API >= 26.
+ if (Build.VERSION.SDK_INT >= 26) { // Form data no longer applies to newer versions of Android.
+ // Hide the form data switch.
+ formDataEnabledSwitch.setVisibility(View.GONE);
+ } else { // Form data should be displayed because this is an older version of Android.
+ if (formDataEnabledInt == 1) { // Form data is on.
+ formDataEnabledSwitch.setChecked(true);
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+ } else { // Form data is off.
+ // Turn the form data switch to off.
+ formDataEnabledSwitch.setChecked(false);