Thursday, July 27, 2017

GOTO 2016 • Better Android Development with Kotlin & Gradle



The introduction part of the video he talks about how kotlin is better then java:
Different android version have different java version
Syntaxal problem in Java like lambda
Gradle officially support kotlin
Cleaner code for other developers

Its a great talk for anyone who wants to start kotlin.

Monday, May 22, 2017

Kotlin is now official

Kotlin was announced in Google IO as an official language to create android app. This is extremely good news :)
There are 2 videos related to kotlin in Google IO.

Introduction to Kotlin


and

Life is Great and Everything Will Be Ok, Kotlin is Here



Wednesday, May 17, 2017

Google IO 2017

Google IO would start soon (1 Hours from this post). There are tons of android related talks this year.
Here are the list of the talks

Most of the talks I'm looking forward to are the ones in May 18, with understanding color and android animations sprint to life on 19th.
What are the ones you look forward to?

Monday, October 3, 2016

Android Links 3

Android round of android links :)

1) Kotlin for Android developers

Why you should consider kotlin as a development language for android

2) ConstraintLayout links
Here are few links that talks about the new layout.
ConstraintLayout, Inside and Out: Part 1
ConstraintLayout, Inside and Out: Part 2


3) MPAndroidChart
This is graphing library which is really useful if you need to add graphs on your app.

4) 80+ Best Resources for Android Developers 2016 (Blogs, Forums & More)
This is a really good list for resource for Android developers.

Wednesday, August 10, 2016

PaperParcel with Kotlin

When I started to code in kotlin, one of the libraries that I found that was really useful is PaperParcel. PaperParcel is a library that would generate Parcelable using annotation. The good thing about it, is that it will reduce the amount of code and mistake you could make if you manually create those classes. Having said that, the library is not purely for Kotlin and it could be used in Java Android project.

To use it in kotlin
You will need to add these to your app build gradle dependencies
compile 'com.github.grandstaish.paperparcel:paperparcel:1.0.0-rc4'
compile 'com.github.grandstaish.paperparcel:paperparcel-kotlin:1.0.0-rc4'
kapt 'com.github.grandstaish.paperparcel:compiler:1.0.0-rc4'
while still in that gradle file, add these before dependencies
kapt {
    generateStubs = true
}
repositories {
    maven { url 'https://jitpack.io' }
}

Now the fun part, this is taken from my app Daily Picture Quotes
@PaperParcel
data class QuoteImage(val id: String = "",
                 val name: String = "",
                 val text_quote: String = "",
                 val url: String = "",
                 val created: String = "",
                 val cursor:String? = "") : PaperParcelable {
    companion object {
        @JvmField val CREATOR = PaperParcelable.Creator(QuoteImage::class.java)
    }
}

Thats about it, you can use QuoteImage to pass around Activities or Fragment or use it with your custom class.

Two things you have to remember is that your data class name must be supplied in PaperParcelable.Creator and every time you make changes to this data class (atleast for me) you have to do rebuild project.

If this interest you then have a check on the kotlin usage section of their github page.

Hope this helps :)