Learn Android With Kotlin

This Project Helps you to Learn Android using Kotlin language. The project consist of different branches, each branch dedicated to explanation and usage of specific View (concept) in Android.

Benefits of Learning

You Learn Android Concepts & Kotlin Concepts hand-in-hand

How to Use the code

(Copy & Paste this Kotlin Code as per requirement & Understand the Kotlin documentation from Links provided)

Prerequisite (Read at least once)

  1. Kotlin Basic Syntax
  2. Kotlin Basic Types Knowledge
  3. Kotlin Control Flow
  4. Kotlin Function
  5. Must Read Kotlin Lambdas
  6. Kotlin Collections

Branch 1 : say_goodbye_to_findViewById_using_kotlin :

  1. This helps you to understand how you can get rid of boilerplate code of traditional findViewById().
  2. It also helps us to understand how view properties can be accessed programmatically
  3. This is possible because of Kotlin plugin.
  4. This will allow you to access views in the layout XML, just as if they were properties with the name of the id you used in the layout definition.
  5. For More details read : Kotlin Android Extensions

Branch 2 : edittext_kotlin :

  1. This helps you to understand how Fragments & EditText can be used with Kotlin code.
  2. We learn here How Fragments can be declared, accessed & How EditText can be used.
  3. Kotlin concepts used here are :

Branch 3 : toast_message_kotlin :

  1. This helps us to understand how Toast message in displayed with Kotlin Code.
  2. Almost similar to Java way of displaying message
  3. As we know requireActivity(), is used to get Activity Context in Fragment
  4. Another way of getting Activity context can be seen in code
  5. We also learn how to show Custom Toast message with custom view, setting Gravity for Message where it should be displayed.

Branch 4 : dialogs_kotlin :

  1. This helps us to understand how Dialog message is displayed with Kotlin Code.
  2. We also learn how to add Positive, Negative, Neutral button for dialog also given here.
  3. Custom Layout for dialog can also be added for dialog with custom views

Branch 5 : listview_kotlin :

  1. This help us to understand how ListView is displayed with kotlin Code.
  2. Also, how Simple & Custom ListView with custom view, and of custom type works in kotlin.
  3. We can see a very little difference in Java & Kotlin implmentation for custom ListView.
  4. Kotlin concepts used here are :

Branch 6 : pass_data_activity :

  1. This help us to understand how data can be transferred from one Activity to another using Intent.
  2. Data can be of String, boolean, double etc type.
  3. Minor things like getting activity context in Fragment, finish activty in kotlin also explained here.

Branch 7 : pass_data_fragment :

  1. This helps us to understand how data can be transferred from one Fragment to another using Bundle.
  2. Data can be of String, boolean, double, int etc type.
  3. No major kotlin concepts used, very similar to java way of creating Bundle, add data, set bundle data to fragment, get data from bundle.

Branch 8 : radiogroup_kotlin :

  1. This helps us to understand how RadioGroup, RadioButton is used in Android using Kotlin.
  2. We also understand how radio group is accessed, checkedChangeListener of radio button, how to get selected radio button data etc.
  3. Also, different ways of accessing individual radio button and selected radio button properties.

Branch 9 : checkbox_kotlin :

  1. This helps us to understand how Checkbox is used in Android using Kotlin.
  2. We also understand how checkChangeListener of checkbox is used for checkbox events.
  3. It is almost similar java implementation with some syntax changes of Kotlin.

Branch 10 : recyclerview_kotlin :

  1. This help us to understand how Recyclerview is implemented in Android with Kotlin.
  2. It's almost a similar way how Recyclerview is implemented Java way.
  3. Here also we deal with Adapter class, clickListener event for Recyclerview.
  4. Reference for how Lamba can be used as ClickListener for RecyclerView Tutorial.
  5. Kotlin concepts used here are :

Branch 11 : navigationdrawer_kotlin :

  1. This help us to understand how basic Navigation Drawer can be implemented in Android using Kotlin.
  2. The best thing is almost similar implementation of Java way with very less code.
  3. Navigation Drawer items click & adding menu item xml is same like Java
  4. It also requires ActionBarDrawerToggle for Navigation drawer working.
  5. Kotlin concepts used here are :

Branch 12 : options_context_menu_kotlin :

  1. This help up to understand how Options & Context menu is implemented in Android using kotlin.
  2. It is almost similar implementation of Java way.
  3. Inflating menu & setting menu click listener are only things to implemented carefully.

Branch 13 : progressdialog_kotlin :

  1. This help us to understand how ProgressDialog can be used in Android using kotlin.
  2. Similar way of Java(creating progress bar instance, setting title, message, style)
  3. Different properties can be set programmatically based on requirement.

Branch 14 : notifications_kotlin :

  1. This help us to understand how Notifications can be used in Android using kotlin.
  2. It follows similar Java way of implemenatation but using kotin 😆
  3. Here we also need to use NotificationManager, Notification Builder, Notification Channel to create basic notification
  4. Notification style, image, content, image, intent etc can be set programmatically

Branch 15 : runtime_permissions_kotlin :

  1. This help us to understand the basics of how runtime permission can be implemented in Android using kotlin.
  2. Checking permission for already granted, requesting permission if not, handling the state after permission granted is almost the same as in Java
  3. Too much easy with Kotlin code.

Branch 16 : tabview_kotlin :

  1. This helps us to understand how basic TabView can be implemented in Android using Kotlin.
  2. It also follows similar Java way of creating Adapter class required for displaying Tabs.
  3. Tab displayed here are with help of TabLayout & ViewPager.
  4. New Kotlin concept to learn here is :