0
What's wrong with my audio record function in Android Studio?
Hello there I'm trying to program a audio-record function in Android Studio, but something is wrong. The app crashes, when I call this function from an button click. The idea would be, that the audio stops again, when I click the button again. But the start function never starts I also added the MediaRecorder.java file. There are tons of errors in it and I don't know where to start. When I build the app, the builder doesn't say anything about these hundreds of errors in this Java file. Maybe they're not relevant? My app is written in kotlin. Please, can you guys help me? Thank you so much for your answers. Kind regards Peter https://code.sololearn.com/c2UoO75dJc8O/?ref=app https://code.sololearn.com/cQkp1rZIRay0/?ref=app
12 Respostas
+ 1
I guess this would help you
https://code.sololearn.com/c5mZvjUHs1yv/?ref=app
+ 2
Hey Peter, can u post the log trace screen shot from android studio it will show you red letters on the log catcher screen shot it
+ 2
The kotlin code you provided isn't enough to record a audio.
+ 1
Peter can you show up the screen shot, it would be easy to find out the error (screenshot it when red log appears)
sorry, if I board you out I just ask you the screenshot because it is hard to find the error but if it's a picture the errors are organised and colored
+ 1
And ...
While you are taking screenshot, streatch the logcat and at the time the app is crashed red logs are appeared screenshot that
+ 1
Thank you all for your help.
Ananiya Jemberu here it is: https://www.sololearn.com/post/1005836/?ref=app
https://www.sololearn.com/post/1005842/?ref=app
I have edited the app package name with a black marker. Just for privacy reasons... Thank you all for help.
Peter
+ 1
Thank you so much for your answer, Ananiya Jemberu .
I want to make a digital assistant app and I don't know where I should store those audio clip files and for how long (?). It should just be used to run a future speech to text script, which I will write.
Now - the output path is still undefined - I have an error with the Environmment.getExternalStorageDirectory() Code.
Please take a look at the followed post.
I don't know why there's the erorr. Is it because I don't have setted up the output path? I have imported it with "import android.os.Environment.getExternalStorageDirectory" but it is never used. (it is grey)
Thank you for your answer.
Kind regards
Peter
https://www.sololearn.com/post/1008589/?ref=app
+ 1
Oh, sorry I just spelled incorrectly
Use
Environment
Instead of
Environmment
here's the library https://developer.android.com/reference/android/os/Environment
tip: don't create a class if you got an error while you are importing instead search for the error that you are encountering or respell it
because the class that you are trying to import is collection of many functions, methods yet if you create new it will be hard work
+ 1
Peter and..
You should not use "voice recorder" and store it as a file for an assistant purpose. Instead you should use "speech-to-text" for instant reading purpose
This may help you jump https://dev.to/rtficial/speech-to-text-and-text-to-speech-on-android-432p
+ 1
Oh! đ Would it be possible to do it without Google. I don't wanna have a spying 3rd party plugin... Thank you for your help.
+ 1
They developed it to be used for free, so not illegal đ
0
Ananiya Jemberu thank you for your help. Here it is:
https://code.sololearn.com/WhxSZl9lw8EG/?ref=app