just started working in Android Studio, for most of the things I can find just fine everything with "Google it" but apparently for this thing I don't. I have a basic switch button that I want to change the app color background from white to black and back unchecking the button. The interrogation is really simple and works just fine changing the text of the switch from "dark mode" to "White mode". The interrogation is done in MainActivity.java.
final Switch BackgroundColorButton = (Switch) findViewById(R.id.BackgroundColorButton);
BackgroundColorButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(BackgroundColorButton.isChecked())
{
BackgroundColorButton.setText("White Mode");
//here I need to change the app background color to Black or DarkGray
}
else
{
BackgroundColorButton.setText("Dark Mode");
//here I need to change the app background color to White
}
}
});