![]() ![]() ![]() tText(resources.getTextArray(R.dob_grib_content) it doesn't work that way ![]() But what works in string resources doesn't work in an array. Here I am trying to do the same in the array resources, I have a very large text there. If you use string resources, then you can change part of the text to a different color or make it bold using text or text. In package kotlin.Help solve the problem. We could assume or we can simply go and check how the Kotlin standard library actually implements these things. We can assume that MutableList is simply another interface for ArrayList, I guess. Uhh, exciting!! So, List isn’t really a simple list per se but is actually an interface for ArrayList. In Kotlin, the default implementation of List is ArrayList which you can think of as a resizable array. What peaked my interest was the last sentence of the documentation: Interfaces, Interfaces, InterfacesĪ quick glance at Kotlin’s documentation provides a good overview about what the difference between them is: while List provides read-only access to stored elements, MutableList provides “list-specific write operations” that allow us to add or remove particular elements from an existing list. While I have been unsuccessful in my attempts, with the particulars of what I want to do, I learned quite an interesting amount about what makes a List different from a MutableList, and I’ll share a bit more about what I’ve learned here. ![]() My last attempt involves casting immutable lists as mutable lists, in order to modify a supposedly immutable list into a mutable one. I can almost feel your excitement through this screen! In particular, I’ve been trying to investigate and learn ways in which you can break immutability in Kotlin, either knowingly or unknowingly. I’ve been thinking about immutability a lot…interesting, I know. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |