
Get Started with Kotlin on Android - ing33k
https://developer.android.com/kotlin/get-started.html
======
PedroBatista
I've been playing with Kotlin and I'm liking it, but my god Android
development is such an nasty hellhole.

As good as it is, Kotlin can't fully mask the awful boilerplate and APIs .

~~~
lenkite
Are you already using anko ?
[https://github.com/Kotlin/anko](https://github.com/Kotlin/anko)

------
pawadu
Great getting started page. Short and direct.

As a Kotlin noob, can someone explain to me why the Kotlin on-click listener
doesn't need to specify onClick() like the Java one does?

~~~
realharo
[https://kotlinlang.org/docs/reference/java-
interop.html#sam-...](https://kotlinlang.org/docs/reference/java-
interop.html#sam-conversions)

~~~
htgb
Actually, this is similar to what you can do in Java by using lambdas
(Retrolambda for pre-Java 8, e.g. Android pre-SDK 24). Excerpt from a blog
post [1] about it:

    
    
      mButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              // do something here
          }
      });
    

can be replaced with

    
    
      mButton.setOnClickListener((View v) -> {
          // do something here
      });
    

which is nice for all callbacks, but especially together with ReactiveX where
they are abundant.

[1] [http://zserge.com/blog/android-
lambda.html](http://zserge.com/blog/android-lambda.html)

~~~
tjohns
Worth noting for completeness... In Kotlin you can take that a step further:

mButton.setOnClickListener { /* do something here */ }

(In addition to SAM conversions, both the parenthesis and input variable are
optional.)

------
wiradikusuma
Kotlin and React both on the front page. Anyone can give some compelling
reasons why old Android devs like me should try React Native?

~~~
jorgemf
Personally I don't feel the need to use React if you use kotlin. But there are
few cases where React makes sense. Everything that involves a stream of events
that you need to process and they can fail or you need to retry, them React is
your way to go (I don't feel kotlin is ready for this use case yet). For
example, if you want to use the BlueTooth API it is so easy to use it with
React because of the stream of events.

People are using React for Rest requests, and for APIs where you cannot touch
them it can be a good idea as it provide ways to join results of requests and
other stuff. But if you control the API and it is designed to be simple and
with mobile in mind, there shouldn't be uses cases where a simple request give
you all you need.

It also gives consistency as you treat the same way a click event than a http
request. Some people like this but I don't.

I personally didn't find a good use case to use it in my app, but you might
think diferently. So, I suggest you to try it a little at least an decide by
yourself.

~~~
pennaMan
Have you looked at RxJava/RxKotlin for working with streams?

This can get you started:
[http://reactivex.io/intro.html](http://reactivex.io/intro.html)

~~~
jorgemf
Have you read my comment?

------
ramshanker
Learning curve comparable to go?

~~~
oal
I'd say that depends on which languages you already know. Go is a smaller
language in terms of syntax. No generics, not OO in the sense that it doesn't
have classes and inheritance etc. But if you're familiar with the Java
ecosystem and languages like Scala, or something like Swift or Rust, Kotlin
should be easy to pick up.

