Posts

Kotlin Insight Privacy Policy

  Kotlin  Insight is Application that provides Basic Android app development instruction and examples using kotlin language . For Make Demo Examples We Require Some Permission from User. This privacy policy will help you to which types of Permission We collect from User and also Why we collect. So we hope, You Will Spend Time to read this Privacy Policy. We ensure about Our Application Do not contain any types of Malware and other Personal Informatio n. Which types of Permission Require from User : Location-Permission  For get Current location. Call and SMS Permission  To make Call For Send SMS and Receive SMS. Why We  require  Uses -Permission from User? We required permission from the user for various demo examples and the only purpose for such permission is to demonstrate the user how does the demo examples will work we will not be collecting any data from the granted permission.

What is Retrofit ?

Retrofit is type-safe REST client for Android and Java. Retrofit is a REST Client for Java and Android. It makes it relatively easy to retrieve and upload JSON (or other structured data)  Retrofit automatically serializes the JSON response  In Retrofit you configure which converter is used for the data serialization. It is used to display or get data that stores on  Server and to get API data.

When Statement in Kotlin

 In  Kotlin, when replaces the switch operator of other languages like Java In Kotlin, when can be used in two ways: when as a statement. when as an expression. When Example:- fun main(args: Array<String>){       var number = 4       when(number) {           1 -> println("One")           2 -> println("Two")           3 -> println("Three")           4 -> println("Four")           5 -> println("Five")           else -> println("invalid number")       }   }   output:- Four

Require dependency for Kotlin example

      //dependencies for google map  implementation 'com.google.android.gms:play-services-maps:17.0.0'  implementation 'com.google.android.gms:play-services-location:17.1.0' //dependencies for Retrofit,gson and gson converter implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' // dependency for picasso  implementation 'com.squareup.picasso:picasso:2.71828'  // dependency for facebook shimmer  implementation 'com.facebook.shimmer:shimmer:0.5.0'    // dependency for material design  implementation 'com.google.android.material:material:1.3.0-beta01'          

Variables declaration in kotlin

  Var : It is used to declare mutable variable it means it can change the value of variable. Once we declare variable we can change the data of variable . Example: var a=1 In kotlin it is atomatically take datatypes   of the variable . Also, we can specify data type of variable Example: var a:Int =1 Val: It is used to declare Non mutable variable it means it can not change the value of variable. It is work as read only variable. It is same as final keyword in java. Example : Val myname=”kotlin” Lateinit: Iateinit means late initialization . you have to initialize the variable late . If you not initialize the variable than throws exceptions   . Example : lateinit var myname :String

Difference between kotlin and Java .

Kotlin: Kotlin supports Object-oriented and functional programming . There are no Null variables in kotlin . It doesn’t supports implicit conversation. Kotlin does not require to specify data types of variable . Kotlin do not require semicolons. Less chances to crash application. Java: Java supports only limited Object-oriented . Null variables and objects are parts of Java It supports implicit conversation. While java require specify data types of the variable. Java require semicolons. More chances to crash application.

Why Kotlin ?

It is faster than Java. It is Expressive and concise language it is supports to focus on expressing ideas. It provides safer code . because of it helps you to avoid Null pointer Exceptions. In kotlin included @Nullable and @NonNull in its type system. So application less crash . In kotlin code is clean. It is support more features than   java.