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.

20th Dec 2020, 11:43 AM
Gabriel
11 Respostas
+ 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 😬
20th Dec 2020, 3:25 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 5
Gabriel sorry but where is your requestPermissions() function, is it exist outside, is that function provided by android.os package.
20th Dec 2020, 1:27 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 2
Gabriel , Bro we are asking where you defined requestPermissions() method? You are calling it but we don't see where it's defined.
20th Dec 2020, 3:07 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 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.
20th Dec 2020, 12:33 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
🇮🇳Omkar🕉 Yes, sry. I forgot it. Here it is: No value passed for parameter 'permissions' No value passed for parameter 'requestCode'
20th Dec 2020, 12:38 PM
Gabriel
+ 1
Gabriel , OK. I'll see if I can solve this.
20th Dec 2020, 12:46 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
It works! Thank you all so much for your help.
20th Dec 2020, 3:32 PM
Gabriel
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)
20th Dec 2020, 3:04 PM
Gabriel
0
Oh, maybe I forgot that. How can I add it?
20th Dec 2020, 3:12 PM
Gabriel
0
Gabriel, What you want to edit? Your code? Just visit the link and you can edit then save.
20th Dec 2020, 3:15 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
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...
20th Dec 2020, 3:18 PM
Gabriel