0
Please help btn onClick Listener Error
Hey guys When I run my app, the stack trace says, that my button on click Listener in line 35 isn't working. Can anyone help me? I don't know what's wrong. Here is the Code: https://code.sololearn.com/c9wvkqKJ9Jg0/?ref=app Thank you all so much for each little help.
11 Réponses
+ 2
Gabriel,
Okkk.. now I get it.
You followed that YT tutorial where the author named their function requestPermissions() but then you started doing something different and named your function requestRecordAudioPermission() but forgot make changes in click handler. You were supposed to call your requestRecordAudioPermission in click handler.
on line 39 call requestRecordAudioPermission() instead of requestPermissions() (which doesn't exist)
I hope I didn't confuse you more 😬
+ 5
Gabriel sorry but where is your requestPermissions() function, is it exist outside, is that function provided by android.os package.
+ 2
Gabriel ,
Bro we are asking where you defined requestPermissions() method? You are calling it but we don't see where it's defined.
+ 1
@Gabriel can you post exact error message?
Maybe you wanted to call requestRecordAudioPermission() method which is defined and not requestPermissions() which seems to be not defined in that file.
+ 1
🇮🇳Omkar🕉 Yes, sry. I forgot it. Here it is:
No value passed for parameter 'permissions' No value passed for parameter 'requestCode'
+ 1
Gabriel , OK. I'll see if I can solve this.
+ 1
It works! Thank you all so much for your help.
0
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
It should be this:
private fun requestRecordAudioPermission(){
var permissionsToRequest = mutableListOf<String>()
if(!hasRecordAudioPermission())
permissionsToRequest.add(Manifest.permission.RECORD_AUDIO)
0
Oh, maybe I forgot that. How can I add it?
0
Gabriel, What you want to edit? Your code? Just visit the link and you can edit then save.
0
I want to add the missing Code, where I can define requestPermissions()
But I don't know how to define it.
I feel like an idiot now...