Android

ANKO IN KOTLIN

ANKO IN KOTLIN

Anko stands for (An)droid (Ko)tlin is a library used by the app developers to implement many functions and features using a single dependency library. It is very useful to speed up the app development process more faster as possible.

Anko has mainly four modules:

  • Layouts
  • Commons
  • SQLite
  • Coroutines

The first step for using Anko library features, is to set our project with the corresponding dependency in our project such as build.gradle and also add the latest Anko version(0.10.8) in our project.

Anko Layouts

App development includes both the drag-and-drop and xml coding for designing our application. But by using Anko Layouts it is simply done using code like a DSL, meaning that it doesn’t need switch language between context and place.

Anko Commons

The Anko Common has a lot of helper functions for Android SDK and it is lightweight in nature. Anko Commons includes the following

  • Dialog and toast: Dialog is a smaller window popped while getting some feedback for some operations in our application. Unlike Dialogs toast gives a small feedback as a message for a short time specified in the application while performing some operations
  • Intent: It provides a communication between the activities (move from one activity to another) and the data sharing of components used in the application
  • Logging : Logging is used to debug our application

Anko SQLite

Anko SQLite helps to reduce the many critical situations that we are moved by using a normal SQLite android such as Cursor, String based SQL commands – error prone, closing the database each and every time. Say goodbye to all these problems by Anko SQLite.

Anko Coroutines

Anko Coroutines helps to perform asynchronous tasks in an impressive way by implementing its dependencies. We can write code by Callback pattern and a return value of functions as called by the asynchronous code.

Advantages of Anko Library

  • Forget casting
  • Type and null safe in nature
  • Save CPU time and battery
  • More flexible
  • Support existing codes
  • Reduces line of codes
  • Reduce coding time
  • Reduce development time

Disadvantages of Anko Library

  • Does not support constraintLayout
  • It has no layout preview

Author: STEPS

Leave a Reply

Your email address will not be published. Required fields are marked *