Hi all was hoping to get some help on a request for a noob!
I want to create a button (text="start recording") to start audio recording for android on Android Studio. However, when the user pushes the button to start the audio recording, I want the text on the button to change to "stop audio recording". So when the user wants to stop the audio recording he will push the same button again.
I would also like one more feature, which is in case the battery on the phone would die, I would like the audio record to automatically complete and write the audio to the phones external or internal memory.
I am very new to coding and any help would be greatly appreciated! I have spent a lot of time googling how to achieve this, unfortunately, I don't even know the correct terminology to achieve what I want. Googling has not helped me greatly.
I am a lawyer by trade and I am currently building a legal rights related app, that will provide legal information to the public for free. One of the functions of the app is to record police officers who are searching the public.
This is why I want to have one button, that a user only needs to push once to start recording. In case, the person gets arrested and is not able to use his phone further, they will be safe in knowing that the audio is recorded on their phone and can use it later. This is why I want the audio recording to automatically to stop recording before the phone dies.
I come from New Zealand where it is legal to record police officers in public. This is also important from a legal perspective, as police officers are known to not inform a citizen of their rights before searching or arresting a person. In addition, they also account different versions of the story from the person they arrest.
Code yourself a boolean isRecording
. In your buttonClickEvent you simply check this boolean to get the status of your recorder and so obtain a condition for your actions (start/stop, set text, ...).
Pseudocode:
onClick(){
if(isRecording)
{
stopRecording();
isRecording = false;
textView.setText("start")
}
else
{
startRecording();
isRecording = true;
textView.setText("stop");
}
}