Compiling Error
Title
Question
Please this line of code is giving me compiling error "languageOptions.addAll(ArrayList(fossVsLanguage.get(selectedFoss)))".
This is the compiler error below:
<span style="background-color: rgb(250, 250, 250);">Type inference failed. Please try to specify type arguments explicitly. Type mismatch: inferred type is kotlin.collections.ArrayList<string>? /* = java.util.ArrayList<string>? */ but (MutableCollection<out string!="">..Collection<string!>) was expected</string!></out></string></string> </span>
<span style="background-color: rgb(250, 250, 250);">
</span>
</span>
<span style="background-color: rgb(250, 250, 250);">Please I restart it but the problem persist.</span>
<span style="background-color: rgb(250, 250, 250);">I also read the blog you send but the problem keep on coming.</span>
<span style="background-color: rgb(250, 250, 250);">Thank you.</span>
Android-app-using-Kotlin Creating-a-Search-App 08-09 min 20-30 sec
Answers:
Use the code in the code files link which is available below the video player.
Please I have used the code in the code file below the video but the problem still persist.
Hi Friends
use below code (since languageOptions is mutable list we have to convert the arraylist we get, that is, fossVsLanguage to mutable list):
languageOptions.addAll(fossVsLanguage.get(selectedFoss) as MutableList<String>) instead of languageOptions.addAll(ArrayList(fossVsLanguage.get(selectedFoss)))
Login to add comment