Android_guides: Write Kotlin version of code samples.

Created on 24 May 2016  ·  8Comments  ·  Source: codepath/android_guides

Kotlin for Android App development is gaining some traction and some developers have started using it in production. Gradle also recently announced _Gradle Script Kotlin_.

It will be helpful to have Kotlin version of the code samples.

Some suggestions on how to go about it:

  • Write the Java and Kotlin codes side by side. e.g.

Java
Intent intent = new Intent(context, activity);
Kotlin
val intent = Intent(context, activity)

  • Create different page for the Kotlin stuff.
  • A different repo??
  • Or any other better suggestion

I am willing to contribute if this is possible.

Most helpful comment

@savekirk You did an excellent job, the draft looks great. Here's the first published version. I've added this to the "Getting Started" section on the home page as well. Would love for others to take a look at continue to add / improve to the guide as well. We've announced the guide here. I've added some attribution to the guide indicating that you are the original author, thanks for putting that together.

I wish github wiki had a "native" way to create a "language toggle" in guides. We have this same issue with iOS (Swift vs Obj-c)

All 8 comments

👍

Thanks for reaching out about this. I am not sure of the best way to go about this given how many guides there are and how noisy it would be to have two languages on the same page.

I would love to see (as a start), a separate Kotlin language guide primer page created on the wiki which compares the Java vs Kotlin way of coding common files and actions (i.e Activity, Fragment, Intent). For now, let's create that as a separate Kotlin page and we can expand later from there.

That is a fair concern about the notes getting noisy. So I will go ahead and create new Kotlin guide content and then add the link to it here for review.

Sounds good, thanks for putting together a first draft. I'm sure people will appreciate having a clear, concise Kotlin primer available. We can link to other helpful Kotlin resources as well.

Draft available now https://hackmd.io/s/H12nvIMQ

@savekirk You did an excellent job, the draft looks great. Here's the first published version. I've added this to the "Getting Started" section on the home page as well. Would love for others to take a look at continue to add / improve to the guide as well. We've announced the guide here. I've added some attribution to the guide indicating that you are the original author, thanks for putting that together.

I wish github wiki had a "native" way to create a "language toggle" in guides. We have this same issue with iOS (Swift vs Obj-c)

I do think the first place to start is actually documenting how to use Kotlin with Gradle given this announcement (http://www2.gradle.com/e/68052/blog-kotlin-meets-gradle-/72yb5y/171267988). It will hopefully be far easier for new people to learn how to use Kotlin than Groovy syntax.

Gradle buildscript with Kotlin is not yet ready for prime use. We might want to wait till they have stabilized it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

betorobson picture betorobson  ·  71Comments

kpradeepkumarreddy picture kpradeepkumarreddy  ·  5Comments

nesquena picture nesquena  ·  4Comments

nesquena picture nesquena  ·  11Comments

debpedrano picture debpedrano  ·  8Comments