I have two activities, the one “Main.java” that initially loads I have a couple mediaPlayers that are created which control background music and a voice over.
The second activity is a “Settings.java” which is accessed through a settings cog icon, where I want to use On/Off toggle switches to allow the user to mute the two different mediaPlayer’s.
The problem is, when I try to access the mediaPlayer name in the second activity, it can’t find it since it’s in a different activity. I know this is a rather simple problem but this is my first app and first project in Java. Any help appreciated!
You could save a preference, say
'isPlayerOn'in yourSettingsActivityand check this preference in yourPlayerActivity‘sonResume. You can makeSettingsActivity extend PreferenceActivityso you don’t write extra code in there.