Kotlin parallel coroutines

Is it acceptable to save multiple job instances from separate coroutines. Let's say i want to run a couple coroutines at once in which they are unrelated and cannot happen in one coroutine but i want them to run parallel. In Android i should be savin...
more »

2017-11-10 21:11 (2) Answers

Generic wildcard types are not supported

I'm getting the following error: Could not deserialize object. Generic wildcard types are not supported (found in field m1(Map<String,Any>).someStringInM1(String)) This error is generated by the following line (I'm using Firestore's Andro...
more »

2017-11-08 23:11 (1) Answers

Kotlin Configuration error

I have started kotlin programing in android.I setup the kotlin in android studio.But gradle failed to build project. Kotlin reflection lib error. Here is my Logcat: Information:Gradle tasks [:app:assembleDebug] Error:com.android.builder.dexin...
more »

2017-11-07 07:11 (1) Answers

Reasonable situations to use Kotlin's `let`

In Kotlin, it's common to use let to execute code if an object (let receiver) isn't null, as an alternative to an if != null check, as in the following: val nullable: String? = "anything" nullable?.let { println(it) } In what other situations ...
more »

2017-11-06 19:11 (2) Answers

What is a simple MapRowParser in Anko?

I have read the docs for Anko SQLite. I know that creating a simple RowParser iscan be done by doing val rowParser = classParser<Person>() The classParser is a function defined in the Anko-SQLite source code. How can I get a simple MapRowPa...
more »

2017-11-05 07:11 (1) Answers

Recyclerview: listen to padding click events

I have an horizontal RecyclerView with leftPadding = 48dp, topPadding = 24dp and clipToPadding = false. It starts with an empty space on the left, but when the user scrolls the list its items are drawn on that (previously empty) space. The top space ...
more »

2017-10-25 12:10 (1) Answers

Differentiate ambiguous Extensions in Kotlin

I came upon an issue where the compiler "cannot choose among the following candidates" when I refer to rng.max where rng:IntRange: inline val <T:Comparable<T>> ClosedRange<T>.max get() = endInclusive // max of range inline val &l...
more »

2017-10-20 17:10 (3) Answers

Why use inline without lambdas

I'm trying to understand how to use inline modifier correctly. I understand general case, when we inlining lambda to prevent excess allocation, as described in docs. I was inspecting kotlin stdlib and found in _Strings.kt the following piece of cod...
more »

2017-10-19 15:10 (3) Answers

How to declare raw types in Kotlin?

In Java I can declare this private List a; //onCreate a = new ArrayList() But in Kotlin it shows error, it forces me to specific a type private List<String> a Sometimes I do not want to provide a type ( I do not need to) but it shows err...
more »

2017-10-19 13:10 (2) Answers

Dagger can not provide injection with Kotlin

I have this issue when I try to use Kotlin and Dagger 2 . "interface cannot be provided without an @Provides- or @Produces-annotated method.” This is my Module class: @Module class MenuActivityModule(@NonNull private val menuActivity: MenuActiv...
more »

2017-09-30 20:09 (1) Answers