Issue
I have a code:
fun loadSounds(): List<String> {
try {
val soundNames = assets.list(SOUNDS_FOLDER)!!
Log.d (TAG, "Found ${soundNames.size} sounds")
return soundNames.asList()
}
catch (e: Exception) {
Log.e(TAG, "Could not list assets", e)
return emptyList()
}
}
I couldn't compile it, because of error:
Unresolved reference: asList
How can I convert array (array<(out) string!>) to list? And what does array<(out) string!> mean?
Update: I have a promblems with asList(), toList() and split(), they are unresolved references.
Solution
The main reason was not in checking for the nullability, but in the project settings, something was broken (maybe stdlib including or something else). I copy my code and paste it in another empty project, rename it and everething is fine now.
Answered By - Dmitry Fedorov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.