-
Book Overview & Buying
-
Table Of Contents
Android Programming for Beginners - Fourth Edition
By :
We have already seen the String type as arguments for the function calls to Log.d. We have also seen Strings in the Types Demo app with this code:
val tag = "TypesDemo"
The tag variable is a String where the type has been inferred. We can also write the above code and declare a String explicitly like this:
val tag: String = "TypesDemo"
We also saw String in the previous chapter in the autogenerated code as an argument for functions. As a reminder, here are those Strings with some context added as comments:
// In the onCreate function
name = "Android"
...
// In the Greeting function
text = "Hello $name!",
Feel free to revisit the autogenerated code to see the precise context. What we will do now is learn more about Strings and introduce the baby sister of String, Char. Let's cover String first.
As we can see, a String is a sequence of characters and the main type for handling text. So, what can we do about them? We...