I am currently developing a Voice Recorder app for Android. I am trying to access a few methods in my MainActivity
from my Settings activity, in order to change some settings for my MediaRecorder
.
I have the method below, which sets up the Audio Settings for the recording, in my MainActivity
.
// set up all audio settings
private void setAudioSettings() {
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setAudioSamplingRate(44100);
mediaRecorder.setAudioEncodingBitRate(96000);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
}
In my Settings activity, I have a standard preferences screen that I would like to show options to change the audio codec, sampling rate, etc. of the media recorder in MainActivity
.
How can I access the setAudioSettings
method from MainActivity
here in order to do so?
If you need to see more code or screenshots, please let me know.