Questions tagged as 'kotlin'

1
answer

What is the difference between enum and sealed in Kotlin?

What is the difference between enum (Enum Classes) and sealed (Sealed Classes). And when it is advisable to use them. enum class Direction { NORTH, SOUTH, WEST, EAST } sealed class Direction { class NORTH class SOUTH...
asked by 24.09.2018 / 22:41
2
answers

Android notifications

I have the following problem. I have an app that receives push notifications from firebase. So far excellent. When I receive the notification, what I do is create a notification in the following way: private fun sendNotification(messageBody...
asked by 15.02.2018 / 16:10
1
answer

I can not connect to my service using retrofit2 using API 19

The problem I have is that I was testing with different versions of the SDK and with a samsung SM-A500M version of the API 19 it jumps in front of the onFailure and the error that I get is the following:    SSL handshake...
asked by 22.02.2018 / 20:15
4
answers

How to make a switch in kotlin

I have the following example switch in java: int variable = 2; switch(variable){ case 1: //cosas break; case 2: case 3: break; case 4: //cosas break default: break; } What I want wi...
asked by 21.11.2017 / 20:04
1
answer

Use startActivity within a View in Kotlin Android

To open a activity from another activity use startActivity(Intent(this, SegundaActivity::class.java) But it's not like referring to the this when I want to launch it when I press a button ... in java I indicate it with Main...
asked by 14.05.2018 / 12:08
1
answer

Difference between classes of type Any and T in Kotlin?

In Kotlin I have run into several fragments of code where they use Any and / or generic classes (T), where the objective is to indicate that this variable can be of any kind. According to official documentation Any is the superclass in kotlin...
asked by 06.11.2017 / 15:08
1
answer

Template handlebars is not filled even when there is data

I am working on a project in Kotlin that generates XML files using templates with Handlebars (in the server side , the version 4.0.6). I have the following class in a .kt file: class miClase(val codigo: String, val nombre: String?) And thi...
asked by 05.12.2017 / 22:40
2
answers

download Build Tools 26.0.2 for Android studio 3.0.1

I want to download Build Tools version 26.0.2 but it will not let me download it because of my geographical position (I'm in Cuba) in the SDK Manager.     
asked by 26.02.2018 / 16:22
0
answers

It does not write (save) the XML it takes from the server

I have an app that previously read an xml file from a server and saved it in the phone so that the user could see the content without internet connection, I have passed my application to kotlin and I find the error that the file no longer save i...
asked by 12.01.2018 / 05:47
2
answers

Change ImageView src by the name of an Android studio image

How can I dynamically change the image of an ImageView using the name of the image? Suppose I have a blue_yellow button, a black_white button and a default button; At the same time I have an image with different backgrounds in the drawable fo...
asked by 04.02.2018 / 23:02