{"id":1369,"date":"2019-06-14T10:00:56","date_gmt":"2019-06-14T08:00:56","guid":{"rendered":"https:\/\/zaven.co\/blog\/?p=1369"},"modified":"2025-04-08T19:55:06","modified_gmt":"2025-04-08T17:55:06","slug":"kotlin-for-android-development","status":"publish","type":"post","link":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/","title":{"rendered":"Why we moved to Kotlin for Android development (and maybe you should too)"},"content":{"rendered":"\n<p>Recently Kotlin programming is really endorsed by Google and most of the developers. We are not an exception. We moved to <em>Kotlin for Android development<\/em> and it was worth it. Here are 8 reasons why we did it.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">1. Boilerplate code<\/h2>\n\n\n\n<p>Kotlin introduced Data Classes and many other features that reduce boilerplate code. For example copy() function that copies an object with the possibility to easily modify its state. This function saves a lot of space and you can use it on immutable values.<\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Here are a simple Data Class <code>\u2018Developer\u2019<\/code> and <code>\u2018developerJohn\u2019<\/code> that want to copy- changing only Developer\u2019s name.<\/span><\/p>\n\n\n\n<pre title=\"Kotlin\" class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">data class Developer(val firstName: String?, val lastName: String?, val age: Int?)\nval developerJohn = Developer(\"John\", \"Kotlin\", 10)\nval twinDeveloperMark = developerJohn.copy(\"Mark\")<\/code><\/pre>\n\n\n\n<p>I copied the first developer and created a twin brother with a different name but the same last name and age. As you can see, you can simply change one value even in an immutable object. It would be a chore to duplicate a bigger object manually only to change one value.<\/p>\n\n\n\n<p>Java is getting better with each version but still forces a lot of boilerplate code. It offers <code>\u2018clone\u2019<\/code> function but usually, it doesn\u2019t work properly and developers advise to avoid it. So in Java, it would look like below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\">class Developer {\n   private String firstName;\n   private String lastName;\n   private int age;\n\n   Developer(String firstName, String lastName, int age) {\n       this.firstName = firstName;\n       this.lastName = lastName;\n       this.age = age;\n   }\n\n   public String getFirstName() {\n       return firstName;\n   }\n\n   public void setFirstName(String firstName) {\n       this.firstName = firstName;\n   }\n\n   public String getLastName() {\n       return lastName;\n   }\n\n   public void setLastName(String lastName) {\n       this.lastName = lastName;\n   }\n\n   public int getAge() {\n       return age;\n   }\n\n   public void setAge(int age) {\n       this.age = age;\n   }\n\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">Developer developerJohn = new Developer(\"John\", \"Kotlin\", 10);\nDeveloper twinDeveloperMark = new Developer(\"Mark\", \"Kotlin\", 10);<\/code><\/pre>\n\n\n\n<p><code>\u2018Developer\u2019<\/code> is fortunately a small model. Copying much bigger models manually is really annoying and space-wasting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Null safety<\/h2>\n\n\n\n<p><strong>Kotlin<\/strong> <b>gives a smaller probability of app crashes because it\u2019s easy to deal with NullPointerException<\/b>. That\u2019s where many operators come in handy. &nbsp;For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">data class Developer(val firstName: String?)\n\nfun handleDeveloper(developer: Developer?) {\n\n    developer?.firstName \/\/ get firstName if developer is not null\n    developer!!.firstName \/\/ get firstName even if developer is null -&gt; may lead to crashes\n    developer?.let { \/\/ let me operate on developer in a block of code if developer is not null\n        it.firstName\n    }\n}<\/code><\/pre>\n\n\n\n<p>Java 8 introduced Optional but it&#8217;s still harder to deal with NullPointerExceptions. Also, in Android development Java Optional is fully available only for Android 7.0+.<\/p>\n\n\n\n<div class=\"wp-block-image wp-image-1392 size-full\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\"   src=\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/05\/Zrzut-ekranu-2019-05-29-o-15.29.24.png\" alt=\"Kotlin for Android development\" class=\"wp-image-1392\"\/><figcaption>Trying to use Optionals when minimum API is below level 24<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">3. Flexibility<\/h2>\n\n\n\n<p><strong>Android development with Kotlin<\/strong> <b>is very flexible thanks to Extension Functions<\/b>. If a class doesn&#8217;t have a useful function that would make your code fluid and readable- you can create this function yourself. For example, if you want to create a function that returns initials of the full name -&gt;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">fun Developer.getInitials(): String {\n   val firstNameInitial = firstName?.firstOrNull()?.toUpperCase()\n   val lastNameInitial = lastName?.firstOrNull()?.toUpperCase()\n   if(firstNameInitial == null || lastNameInitial == null) {\n       return \"N\/A\"\n   }\n\n   return \"$firstNameInitial$lastNameInitial\"\n}<\/code><\/pre>\n\n\n\n<p>By the way <code>\u2018firstOrNull()\u2019<\/code> is an extension function too.<\/p>\n\n\n\n<p>Java doesn&#8217;t provide Extension Functions, you are limited by methods that exist in a class or you have to override it. You can use regular static methods but it\u2019s a less readable solution. If you want to do the same in Java, look below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\">static String getInitials(Developer developer) {\n   Character firstNameInitial = null;\n   if (developer.getFirstName() != null) {\n       firstNameInitial = developer.getFirstName().toUpperCase().charAt(0);\n   }\n\n   Character lastNameInitial = null;\n   if (developer.getLastName() != null) {\n       lastNameInitial = developer.getLastName().toUpperCase().charAt(0);\n   }\n\n   if(firstNameInitial == null || lastNameInitial == null) {\n       return \"N\/A\";\n   }\n\n   return firstNameInitial.toString() + lastNameInitial.toString();\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. Accessing views<\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Kotlin provides AndroidX synthetic imports. That\u2019s why, in Activities, you can directly access Views using their ids assigned in XML. You don\u2019t have to create new variables for them. That\u2019s how it works: <\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">developer_name.text = \u201cJohn\u201d<\/code><\/pre>\n\n\n\n<p>On the other hand, Java requires the use of findViewById which generates a lot of boilerplate.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\">developerName = (TextView) findViewById(R.id.developer_name);\ndeveloperName.setText(\u201cJohn\u201d)<\/code><\/pre>\n\n\n\n<p>Of course, you can use 3rd party libraries like Butterknife but it\u2019s still a mess.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\">@BindView(R.id.developer_name) TextView developerName;\ndeveloperName.setText(\u201cJohn\u201d)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5. Defining types<\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">In Kotlin you don&#8217;t have to define types because it\u2019s optional. Usually, it\u2019s redundant. The <code>\u2018val\u2019<\/code> and <code>\u2018var\u2019<\/code> operators take a while to get used to but are really rewarding. <\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">val name = \"John\"\nvar age = 10<\/code><\/pre>\n\n\n\n<p>Java requires defining types and it makes your code less readable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\"> final String name = \u201cJohn\u201d\nInt age = 10<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6. Scope Functions<\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\"><strong>Kotlin<\/strong> provides <strong>scope functions<\/strong>, like <code>\u2019run\u2019<\/code>, <code>'with'<\/code>, <code>'let'<\/code>,<code>\u2018also\u2019<\/code> and <code>'apply'<\/code>, which execute a block of code within the context of an object.<\/span><\/p>\n\n\n\n<p>Let\u2019s say you want to do multiple operations on the same object. You don\u2019t have to access it, again and again, every time. Declare that you want to work in a given scope using the Scope Functions and your life will be easier.<\/p>\n\n\n\n<p><span style=\"font-weight: 400;\"><code>\u2018run\u2019<\/code>,<code>\u2018with\u2019<\/code> and <code>\u2018let\u2019<\/code> return the lambda result whereas <code>\u2018also\u2019<\/code> and <code>\u2018apply\u2019<\/code> return the context object. <\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">popupMenu.run {\n   menuItemVisibility(R.id.action_close, canViewActionClose)\n   menuItemVisibility(R.id.action_open, canViewActionOpen)\n   menuItemVisibility(R.id.action_done, canViewActionDone)\n   menuItemVisibility(R.id.action_reject, canViewActionReject)\n}<\/code><\/pre>\n\n\n\n<p>My favorite Scope Function is <code>\u2018let\u2019<\/code> because it works perfectly with null safety.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">menu.findItem(R.id.action_download)?.let { action -&gt;\n   if (isActionDownloadAvailable) action.show() else action.hide()\n}<\/code><\/pre>\n\n\n\n<p>If there is no action_download menu item, the block of code won&#8217;t execute. \u2018Action\u2019 inside the block of code is not non-nullable.<\/p>\n\n\n\n<p>When it comes to Java- it doesn\u2019t provide scope functions. You have to show context <code>(popupMenu)<\/code> every time.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java\">popupMenu.setMenuItemVisibility(R.id.action_close, canViewActionClose)\npopupMenu.setMenuItemVisibility(R.id.action_open, canViewActionOpen)\npopupMenu.setMenuItemVisibility(R.id.action_done, canViewActionDone)\npopupMenu.setMenuItemVisibility(R.id.action_reject, canViewActionReject)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">7. Switch statements<\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Kotlin offers <code>'when'<\/code> statements- <code>'switches on steroids'<\/code>. Also, Kotlin introduced sealed classes that are very useful for when statements. They can autofill all possible cases automatically (alt+enter driven development magic) and skip <code>'else'<\/code>&nbsp;a statement.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">That\u2019s how the Sealed Class implementation looks like:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">sealed class FileResourceDownloadResult\n\ndata class DownloadResultSuccess(\n   val file: File,\n   val statusCode: StatusCode\n) : FileResourceDownloadResult()\n\ndata class DownloadResultError(\n   val statusCode: StatusCode,\n   val throwable: Throwable\n) : FileResourceDownloadResult()<\/code><\/pre>\n\n\n\n<p>For now, it may seem that there is nothing special. But here comes my favorite feature since 800 BC -&gt;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">return when (result) {\n   is DownloadResultSuccess -&gt; Result.success()\n   is DownloadResultError -&gt; Result.failure()\n}<\/code><\/pre>\n\n\n\n<p>Notice that there is no else or default branch. You can return a non-nullable result and you don\u2019t have to handle a redundant <code>\u2018else\u2019<\/code> case. I hate this additional case because usually, it generates a lot of mess. Look at what you get when you want to do the same without the Sealed Class:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"kotlin\" class=\"language-kotlin\">return when (result) {\n   is DownloadResultSuccess -&gt; Result.success()\n   is DownloadResultError -&gt; Result.failure()\n   else -&gt; {\n       \/\/ error- you have to provide the else statement\n   }\n}<\/code><\/pre>\n\n\n\n<p>Let\u2019s get back to Java. It provides <code>'switch'<\/code> statements but they always require a default value too. Even if you handle all possible cases exclusively. That\u2019s because Java doesn\u2019t support sealed classes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8. Official Android language<\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">For a long time, Java was a standard language for <em>Android development<\/em>. It has changed two years ago when JetBrains introduced Kotlin. It quickly took over the Android development world. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">By then, for a long time, Kotlin was preferred and promoted by many experienced developers but nobody considered this language as the first-class citizen. But recently Google officially announced that Kotlin is now a preferred language for Android development. Of course, Android still supports Java. But in the \u201cFragmented\u201d, the biggest Android Dev podcast, Google engineers endorsed moving to Kotlin and explained that new code guidelines will be mostly tailored for this language. Fortunately, now it&#8217;s really easy to migrate to Kotlin.<\/span><\/p>\n\n\n\n<div class=\"wp-block-image wp-image-1420 size-full\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\"   src=\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Zrzut-ekranu-2019-06-03-o-10.15.25.png\" alt=\"Kotlin for Android development\" class=\"wp-image-1420\"\/><figcaption>Converting Java file to Kotlin file<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Why we moved to Kotlin for Android development: summary<\/h2>\n\n\n\n<p>There are new and better features provided with each Java version. The problem is they are not popular in Android development. Some of them require Java 1.8 that is fully available only for Android 7.0+. The rest of them can\u2019t be done in Java. But Kotlin has all great features organized and provided by default. So in 2019 <strong>Kotlin for Android development<\/strong> is a way to go.<\/p>\n\n\n\n<p>Also, Kotlin has well-organized documentation that\u2019s easy to read. You can find it <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/\" target=\"_blank\" rel=\"nofollow noopener rel= noreferrer\">here<\/a>.<\/p>\n\n\n\n<p>Check our other article connected with <a href=\"https:\/\/zaven.co\/blog\/how-to-estimate-a-mobile-app-development-project\/\">Android development.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently Kotlin programming is really endorsed by Google and most of the developers. We are not an exception. We moved to Kotlin for Android development and it was worth it. Here are 8 reasons why we did it.<\/p>\n","protected":false},"author":19,"featured_media":1432,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[100,20,12,129,147,127,148,144],"class_list":["post-1369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-development","tag-android-app-development","tag-android-development","tag-app-development","tag-app-development-for-android","tag-java","tag-kotlin","tag-kotlin-for-android-development","tag-mobile-app-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Kotlin Android development. Scope functions | Zaven Blog<\/title>\n<meta name=\"description\" content=\"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Kotlin Android development. Scope functions | Zaven Blog\" \/>\n<meta property=\"og:description\" content=\"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/\" \/>\n<meta property=\"og:site_name\" content=\"Zaven Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-14T08:00:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-08T17:55:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3886\" \/>\n\t<meta property=\"og:image:height\" content=\"1358\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jakub Chmiel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jakub Chmiel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/\",\"url\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/\",\"name\":\"Kotlin Android development. Scope functions | Zaven Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zaven.co\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png\",\"datePublished\":\"2019-06-14T08:00:56+00:00\",\"dateModified\":\"2025-04-08T17:55:06+00:00\",\"author\":{\"@id\":\"https:\/\/zaven.co\/blog\/#\/schema\/person\/a9ba2d2db954fe6348ca24c368288894\"},\"description\":\"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.\",\"breadcrumb\":{\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage\",\"url\":\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png\",\"contentUrl\":\"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png\",\"width\":3886,\"height\":1358,\"caption\":\"Kotlin for Android development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zaven.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why we moved to Kotlin for Android development (and maybe you should too)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zaven.co\/blog\/#website\",\"url\":\"https:\/\/zaven.co\/blog\/\",\"name\":\"Zaven Blog\",\"description\":\"Software development blog. Generative AI, web &amp; mobile applications.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zaven.co\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zaven.co\/blog\/#\/schema\/person\/a9ba2d2db954fe6348ca24c368288894\",\"name\":\"Jakub Chmiel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zaven.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/167f23b65d5911f11d67cbec316eff10?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/167f23b65d5911f11d67cbec316eff10?s=96&d=mm&r=g\",\"caption\":\"Jakub Chmiel\"},\"description\":\"Jakub was a mobile developer at Zaven. He writes about Android development here and on his own blog too!\",\"sameAs\":[\"https:\/\/www.jakubpchmiel.com\",\"https:\/\/www.linkedin.com\/in\/jakub-chmiel\/\"],\"url\":\"https:\/\/zaven.co\/blog\/author\/jakub-chmiel\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Kotlin Android development. Scope functions | Zaven Blog","description":"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/","og_locale":"en_US","og_type":"article","og_title":"Kotlin Android development. Scope functions | Zaven Blog","og_description":"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.","og_url":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/","og_site_name":"Zaven Blog","article_published_time":"2019-06-14T08:00:56+00:00","article_modified_time":"2025-04-08T17:55:06+00:00","og_image":[{"width":3886,"height":1358,"url":"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png","type":"image\/png"}],"author":"Jakub Chmiel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jakub Chmiel","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/","url":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/","name":"Kotlin Android development. Scope functions | Zaven Blog","isPartOf":{"@id":"https:\/\/zaven.co\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage"},"image":{"@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage"},"thumbnailUrl":"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png","datePublished":"2019-06-14T08:00:56+00:00","dateModified":"2025-04-08T17:55:06+00:00","author":{"@id":"https:\/\/zaven.co\/blog\/#\/schema\/person\/a9ba2d2db954fe6348ca24c368288894"},"description":"Have you heard about Kotlin? Such programming, supported by Google, gives brand new opportunities to the clients. Check out how to switch to it - step by step.","breadcrumb":{"@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zaven.co\/blog\/kotlin-for-android-development\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#primaryimage","url":"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png","contentUrl":"https:\/\/zaven.co\/blog\/wp-content\/uploads\/2019\/06\/Baner-boxing-center-e1559553093325.png","width":3886,"height":1358,"caption":"Kotlin for Android development"},{"@type":"BreadcrumbList","@id":"https:\/\/zaven.co\/blog\/kotlin-for-android-development\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zaven.co\/blog\/"},{"@type":"ListItem","position":2,"name":"Why we moved to Kotlin for Android development (and maybe you should too)"}]},{"@type":"WebSite","@id":"https:\/\/zaven.co\/blog\/#website","url":"https:\/\/zaven.co\/blog\/","name":"Zaven Blog","description":"Software development blog. Generative AI, web &amp; mobile applications.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zaven.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zaven.co\/blog\/#\/schema\/person\/a9ba2d2db954fe6348ca24c368288894","name":"Jakub Chmiel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zaven.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/167f23b65d5911f11d67cbec316eff10?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/167f23b65d5911f11d67cbec316eff10?s=96&d=mm&r=g","caption":"Jakub Chmiel"},"description":"Jakub was a mobile developer at Zaven. He writes about Android development here and on his own blog too!","sameAs":["https:\/\/www.jakubpchmiel.com","https:\/\/www.linkedin.com\/in\/jakub-chmiel\/"],"url":"https:\/\/zaven.co\/blog\/author\/jakub-chmiel\/"}]}},"_links":{"self":[{"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/posts\/1369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/comments?post=1369"}],"version-history":[{"count":74,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/posts\/1369\/revisions"}],"predecessor-version":[{"id":69949,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/posts\/1369\/revisions\/69949"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/media\/1432"}],"wp:attachment":[{"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/media?parent=1369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/categories?post=1369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zaven.co\/blog\/wp-json\/wp\/v2\/tags?post=1369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}