Skip to main content

Posts

Showing posts from March, 2018

Kotlin Basic Syntax: Loop and Conditional Control Operator

In this article, we will cover some basic syntax of Kotlin. Like for, dowhile and while loop, if and when control operator, downTo , step , in and its use. These are first and the very basic concept of any programming language. Using the if control operator in Kotlin If the conditional operator in Kotlin is similar to the java and it can be used in the same as like into the java only difference as normal is that we don't require ";"  operator at the end of every line. var a=11 var b=20 if(a < b){ println("$a is less then $b" ) } Output:- 11 is less then 20 Using the if with else control operator in Kotlin we can use the traditional if else statement like we use in the java and syntax for this as given below. println("Enter the number:") var c = readLine() var a=c!!.toInt() var b=20 if(a < b){ println("$a is less then $b" ) } else{ println("$a is greater then $b")

Kotlin Parcelable Array Objects Send To Activity

We know that IPC (Inter Process Communication) between the activity is an extremely important part of any application development. We often required that we need to send some data to other activity. For example, we may be required to send an array of data, data could be an Integer, String, Long, Double, Float or any other custom data objects. So, In this example, we are going to learn how to implement the Kotlin Parcelable Array object to send the data from one activity to second activity. What is Parcel? The parcel class is designed as a high-performance IPC transport. A Parcel can contain both flattened data that will be unflattened on the other side of the IPC, and references to live IBinde r objects that will result in the other side receiving a proxy IBinder connected with the original IBinder in the Parcel. Create Kotlin Parcelable Array Objects Parcelable is API for placing the arbitrary objects into the Parcel. In Actual in android app development, Parcelable is an interface

Android How to Implement Fingerprint Authentication Kotlin

Fingerprint Authentication is essential authorization method for App. It does not mean that current method using pin and password is not good. Existing method is also very useful but the Fingerprint Authentication is unique and it's almost impossible to guess. Fingerprint Authentication feature has been released from Android 6.(M) onward.   In Following tutorial and example shows how to implement Fingerprint Authentication in your application. The benefit of using the Fingerprint Scan Authentication 1 . The main benefit of this is that your identity is never break even after your phone gets misplaced. It doesn't matter how? 2 . It is very Fast, Convenient and Reliable way to Authenticate. 3 . Fingerprints are always unique so its assure that your app will only get unlocked by you. 4 . It will make the online transaction more secure and you can verify your app by just by scanning the Finger. The final app will look as below after implementation. Create the Project First of all,

Basic of kotlin Android: TextView and AutoSize TextView

First of all, we will take look at some of the common View used for Android app development and how to use it using the Kotlin language. TextView TextView is very common view in android app development. Declare the TextView in Kotlin There is two way to declare the View using the Kotlin one is the Java way and other is the Kotlin way. Below is the Java way to declare the TextView Declare the TextView in the XML file, there is no any difference in the declaration. <TextView android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> Initialize the TextView an