Questions tagged [Kotlin] (89)

1
answer

How to call the overridden method using polymorphism?

Trying different ways to bring an instance of the class A3 to A2 and call the method implementation of A2. Always invoked method implementation of A3. What am I doing wrong? package advanced_classes fun main(args:Array<String>){ val a = A3() a.method() //1 (a as? A2)?.method() //2 if(a is A2){ a.method() } } ...
elmore.Grady16 asked April 19th 20 at 12:33
0
answer

As for Room to execute query with join and get everyone on POJO?

As for Room to execute query with join and get everyone on POJO? Table: Message(chat_id, message_id, user_id, date), Attachment(id chat_id, message_id, url, type) Message from composite key: chat_id, message_id. You need to collect from dB POJO MessageJSON ( chat_id: Int message_id: Int user_id: Int attachments: ArrayList )...
Cloyd asked April 19th 20 at 12:13
1
answer

Why Koltlin imports all classes from the local package?

I have a Kotlin project with this structure: . └── org └── gradle └── sample ├── JoinUtils.kt ├── LinkedList.kt ├── Main.kt ├── MessageUtils.kt ├── SplitUtils.kt └── StringUtils.kt Main.kt looks like this: package org.gradle.sample fun main() { val tokens = StringUtils.split(MessageUtils.getMessage()) println(Stri...
adeline.Bradt asked April 19th 20 at 12:01
2
answers

Retrofit kotlin code request fails, why?

A simple query to retrieve data in json format. The problem is that with a successful(!) sending the request code onResponce not running at all - no result, no error, no exception nothing like the program simply skips these lines. At the same onFailure() in the case of obviously broken request (for example, a deliberately b...
kaia.Terry asked April 18th 20 at 12:41
1
answer

Why not a SecurityException when using FusedLocationProviderClient?

//in Activity fun override onStart() { super.onStart() val res = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)== PackageManager.PERMISSION_GRANTED Log.d(TAG, "ACCESS_FINE_LOCATION: $res") //<=== here false var fusedLocationProviderClient: FusedLocationProviderClient? = null val l...
eleazar55 asked April 18th 20 at 12:19
1
answer

How can add the ViewPager class?

Good afternoon. Starting to learn programming for android. Found tutorial, where is the change screens swipe (left-right). When it came to ads ViewPager in MainActivity, then ran into an error (Expecting member declaration). Here is the code: import android.os.Bundle import androidx.appcompat.app.AppCompatActivity class In...
Romaine asked April 18th 20 at 12:14
1
answer

How to pass this to handler.postDelayed kotlin?

Error this parameter is passed to the method handler.postDelayed class MainActivity AppCompatActivity() { private var s:Int = 0 private var running: Boolean = false fun onClickStart(view: View) { running = true } fun onClickStop(view: View) { running = false } fun onClickReset(view: View) { running = false s = 0 } ...
Pink.Boe asked April 16th 20 at 10:48
1
answer

To examine whether kotlin frontend razrabotchiku?

Have extensive experience in frontend razrabotke. Recently briefly met with the documentation for Kotlin and wondered why all the glory took the typescript (of course, it is easier, ecosystem, etc.). At least at first glance Kotlin significantly more thoughtful and powerful language. Also, as I understand it, there is a re...
Jeffrey asked April 16th 20 at 10:46
1
answer

Are there any books for android on kotlin?

Develop an android application written in kotlin
fatima_Effertz asked April 16th 20 at 10:43
3
answers

Kotlin or Swift?

Decided to become a mobile application developer(not games). There is a choice between Android and ios. Studied a lot of articles. I have a new laptop 2012 was not very good and strong bodies under Android is the same. Some say that without the MacBook for ios will very difficult. Others that can be easily circumvented emul...
Hester.Greenfelder asked April 16th 20 at 10:02