What’s Jetpack Compose and its Benefits? Jetpack Compose is a modern UI toolkit recently launched by Google which is used for building native Android UI. It simplifies and accelerates the UI development with less code, Kotlin APIs, and powerful tools. Declarative Compatible Increase development speed Concise and Idiomatic Kotlin Easy to maintain Written in Kotlin To read more, refer to the article: Jetpack Compose in Android Aaaaaa
Nullable Non Nullable Types What’s Null Safety and Nullable Types in Kotlin? What is the Elvis Operator? Kotlin puts a lot of weight behind null safety which is an approach to prevent the dreaded Null Pointer Exceptions by using nullable types which are like String? , Int? , Float? etc. These act as a wrapper type and can hold null values. A nullable value cannot be added to another nullable or basic type of value. To retrieve the basic types we need to use safe calls that unwrap the Nullable Types. If on unwrapping, the value is null we can choose to ignore or use a default value instead. The Elvis Operator is used to safely unwrap the value from the Nullable. It’s represented as ?: over the nullable type. The value on the right hand side would be used if the nullable type holds a null. var str: String ? = "JournalDev.com" var newStr = str?: "Default Value" str = null newStr = str?: "Default Value" How is !! different from ?. in unwrappi...
Android regularly releases Support Libraries , which are a bunch of features . Why Support Libraries ? Android keeps on adding new features. Say you have an App which was created using an older API version and you want to add the new features, you can do so using the Support libraries. So the purpose of these Libraries is to let Apps use new features of Android. What does the number attached to Support Library indicate ? Let’s take the v4 support library as an example. Now the number 4 in this indicates that this can be added to Apps which have been created with an API level greater than 4. Example v4 support library – Includes largest set of features. v7 appcompat library – Support for Action Bars. Can be included with API level 7 and above. In the next lesson you will create a new Project “ThemeDemoApp” to get better understanding of these concepts. Android Documentation – http://developer.android.com/tools/support-library/index.html
Comments
Post a Comment