Most voted "kotlin" questions
Kotlin is a statically typed programming language compatible with JVM and Javascript.
Learn more…234 questions
Sort by count of
-
1
votes1
answer93
viewsOkhttp on Android connects to my websocket server but does not reflect outgoing messages
Following this documentation https://spring.io/guides/gs/messaging-stomp-websocket/ created a small spring project capable of sending messages in real time using websockets, the web part stays this…
-
0
votes1
answer116
viewsError "[ ] cannot be converted to JSON" when trying to create Jsonobject from String
I am using the Kotlin language together with the GSON library to perform JSON object creation/parse. I have the following string that caches a JSON object returned from a server val jsonString =…
-
0
votes1
answer195
viewsHow to recover the status of a button with Sharedpreferences on Android/Kotlin on multiple screens?
Friends, I have two activitys, at first I have a sound button on and off and at second I have some buttons like a name button A and when clicked it should know what the state of the sound button is…
-
0
votes0
answers73
viewsError compileDebugKotlin
Error: Error:Execution failed for task ':app:compileDebugKotlin'. Compilation error. See log for more Details Build.Radle Modulo App apply plugin: 'com.android.application' apply plugin:…
-
0
votes2
answers74
viewsWhat’s missing from this code?
fun main(args: Array<String>) { val minhaTarefa = Tarefa("Daniel", "Programação", 10, "30 de Setembro") minhaTarefa.entregar() } class TarefaDeCasa( var nomeDoAluno: String, var nomeDaMateria:…
kotlinasked 7 years, 1 month ago Khallanak Ginovaef Arklaynnost 49 -
0
votes1
answer32
viewsCrash app when trying to save a file using Objectoutputstream
Mainactivity is like this: turma.alunos.add(Aluno("Weslley", "123")) turma.alunos.add(Aluno("Thiago", "1235")) turma.alunos.add(Aluno("Thayane", "1234")) turma.alunos.add(Aluno("Kelvin", "1253"))…
-
0
votes1
answer184
viewsHow to resolve this error when using Room Persistence Library with Kotlin?
When I send run the app, I get a crash like this on the first call to the database: java.lang.RuntimeException: Unable to start activity ComponentInfo{.../....ActivityLogin}:…
-
0
votes1
answer23
viewsHow to join a Tablayout in Activity with a Viewpager within a Framelayout
I am working on a project where I need to join a Tablayout that is on Activity with a Viewpager that is inside a Fragment in the Activity Framelayout. I’m trying everything, but my brief doubt is:…
-
0
votes1
answer414
viewsHow to search Searchview actionbar for Recycleview data using Kotlin?
Follows code below: class MainActivity : AppCompatActivity(), SearchView.OnQueryTextListener { var list = ArrayList<Shop>() var adapter = ShopAdapter(this, list) var imageModelArrayList:…
-
0
votes1
answer203
viewsHow to use Rxandroid?
I’m trying to use Rxandroid but I’m not getting it. Actually, I wanted to be able to use methods inside an Observable, to access the Firebasefirestore and recover the data inside the Realm. So the…
-
0
votes1
answer81
viewsKotlin - R.string.navigation_drawer_open, Not being imported?
I’m trying to learn Kotlin, but I can’t use navigation_drawer_open, nor the navigation_drawer_close, as shown in the attached image Someone would give me a suggestion of what to do to fix the…
-
0
votes1
answer2046
viewsKotlin vs java performance and is it worth trading java for Kotlin?
The running performance on android (I refer to the speed of the application and not the build speed, because benchmarks on powerful machines showed the slower Kotlin than java in terms of…
-
0
votes2
answers219
viewsIs it possible to call a method within another instance?
I have a Activity which shows a AlertDialog customized, as the class of Activity I put the call of this Alert in another class in a static method. When clicking a certain Alert button (or when…
-
0
votes1
answer237
viewsHow to convert an object to Kotlin of type Any! to another one that is possible to access the fields?
Good morning, I’m having a bit of a problem getting solved on a project. I am trying to make an application that will communicate with the ERP odoo, however, this ERP uses the xml-rpc protocol for…
-
0
votes1
answer87
viewsEdittext losing focus on Listview header
I put a header in my ListView because I wanted him to roll along with her. In this header there are two EditText, When I click on the second, the focus goes back to the first one in less than a…
-
0
votes1
answer82
viewsKotlin + RX Observer without Anonymous
I’m studying Kotlin Android and RX and I only see examples like : val api = StarWarsService() api.loadMovies() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( {…
-
0
votes1
answer27
viewsError: Mismatch "${body.toString()}" in Kotlin
I have this error 'Type Mismatch' in this code ${body.toString()}: fun fetchJson(){ val url = "http://localhost:8080/matematica3/naoAutomatica/get" val request = Request.Builder().url(url).build()…
-
0
votes1
answer69
viewsI don’t know how to get latitude and longitude using Googleapiclient
I’m developing an android app using Kotlin, I followed a tutorial of a topic from here, but it caught the last location that was saved, not latitude and longitude, which is what I need. Follows the…
-
0
votes1
answer179
viewsAccess list from inside a Viewholder in Kotlin
I need to access a list that is in the Adapter, however, I need to access being in a Viewholder, I know that with Java it would be enough to reference the list, however, in Kotlin the list is not…
-
0
votes1
answer70
viewsApply setItemOnClickListener to Gridview Buttons. Kotlin or Java
I made a gridView of buttons, but when I use the setOnItemClickListener method to trigger the respective buttons, it does not work. I want to use the buttons so I can trigger an Intent, knowing that…
-
0
votes1
answer143
viewsAdd navigation-Drawer layout to a project with activitys already created
I created an androod project with all Kotlin, but without the navdrawer layout, now I need to put the navdrawer and include the Activity I have in it If anyone knows how to fit the Acesvity into…
-
0
votes1
answer51
viewsProblems with Thread (Koltin)
I am in a situation where I am building an APP for android to be consulting the Bitcoin price variations on the website Mercado Bitcoin. The APP is already working, the last thing I want to…
-
0
votes1
answer223
viewsmake fields mandatory in Kotlin
override fun onClick(v: View) { val id = v.id if (id == R.id.btn_salvar) { salvar() } // Condição para datePicker if (v.id == R.id.edit_calendar_Pessoa) { // definir as datas val c =…
-
0
votes2
answers120
viewsAndroid Studio 3.2.1 does not locate "Default Activity"
Personal I am with this problem since Android 3.2. I have done the following procedures to try to fix the problem: - I’ve made clean and rebuild the project - I already cleared the cache and…
-
0
votes1
answer59
viewsAndroid Kotlin - App minimizes but maximizes the app starts again
Hello, I have an app that minimizes and maximizes restarts in Activity.MAIN, every time. I found this question but the answer does not solve the problem MAINTAIN ACTIVITY BY MINIMIZING because the…
-
0
votes1
answer190
viewsStudent of Kotlin
I am studying Kotlin and I am learning about builder, I would like to know what the difference is and when is used a primary builder and a secondary builder examples: Init Constructor And set…
-
0
votes2
answers115
viewsHow to overwrite the Onitemselected method of a Spinner?
I’m trying to overwrite the method Onitemselected of a Spinner in my Fragment, the same way I did with the Button, but it’s not working... how could I get the same result? Inside Oncreate, the…
-
0
votes1
answer182
viewsAndroid Studio - XML Layout shows no options and always gives error
Any and all layout I create does not show elements like Linearlayout, Recyclerview and others. Only the options below (and the errors too) Also, XML is always with error saying that it is missing…
-
0
votes1
answer13
viewsKotlin setting up font within Fragment
There I am with a doubt, as I do to, modify the source from within a Fragment? tvAgradecimento.setText("Teste") tvAgradecimento.setTypeface(Typeface.createFromAsset(tvAgradecimento.context.assets,…
-
0
votes1
answer55
viewsReading BD Sqlite Android Studio (Kotlin)
Next guys, I’m having a problem reading a data from the database, with the following method: But I have this little problem on line 68. Where are you saying you expect a value like Tipo() and I’m…
-
0
votes1
answer31
viewsGradle Publish does not upload files to the Nexus repository (Maven 2)
I’m trying to get my project to send the Jars files to a Nexus (Maven 2) repository but I’m not getting it. The project is programmed in Kotlin. This code fragment is as close as I could get to a…
-
0
votes1
answer45
viewsGet Kotlin presets in java
Companywebclient.kt fun find(cnpj: String, success: (company: Company) -> Unit, failure: (throwable: Throwable) -> Unit, finished: () -> Unit) { val call =…
-
0
votes1
answer420
viewsHow is the documentation of a code in Kotlin done? Javadoc, Kdoc and Dokka what exactly are each one?
Guys, I’m researching documentation at Kotlin. Effectively how to carry out the documentation of a particular app, I noticed that it is spoken in Kdoc, but only find Javadoc in version 3.0 of…
-
0
votes3
answers117
viewsWhat technical obstacle for Android not support the new versions of Java
I wonder why the version of java in the Android remains the same after so many years. Against Kotlin update with a certain frequency, it is a technical issue the stagnation of Java?…
-
0
votes2
answers320
viewsPOST using Retrofit is not returning to the Onresponse function
My application is made with Kotlin Retrofit and Gson. I have several gets to fetch information and work normally, manipulate the data returning in Onresponse and ok, works normally. But when I run…
-
0
votes1
answer54
viewsThread Android error that is crashing the app at the time of opening
I’m doing an initial project to test the functionalities of the Speechrecognizer library from google for android, but at the time if climbing the App I’m having problems, in this case it just closes…
-
0
votes0
answers30
viewsVariable problem (Kotlin)
Hello, I’m doing an android Studio project with Kotlin and I’m having the following error. equal.setOnClickListener { try{ val expressao = ExpressionBuilder(expressao.text.toString()).build() val…
-
0
votes1
answer30
viewsHow to run a class code in Android Studio when you don’t have an Activity?
I’m trying to learn Kotlin, but I want to test certain algorithms and I can’t run a class because Android Studio can’t find Main Default. Doesn’t have a way to run a class at the Android Studio…
-
0
votes0
answers111
viewsSwagger’s response body with the message "can’t parse JSON. Raw result:"
I came across an unusual situation in Swagger version 2.9.2. The flow that starts through the created endpoint works normally, but along with the body appears the following message can’t parse JSON.…
-
0
votes0
answers22
viewsHow to read PDF file in Kotlin?
I’m making an app that needs to create a database from information contained in a file. pdf, I need a code in Kotlin to store the file text. I saw how to do this for files . txt and does not work…
-
0
votes1
answer227
viewsRuntimeexception Error
When I start Run from the app a Build gives me the following error java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException:…
-
0
votes0
answers56
viewsProblem with java.lang.Nullpointerexception android.graphics.Bitmap.compress
Hello I’m having this error in my code someone could help me solve this? grateful in advance. java.lang.NullPointerException: Attempt to invoke virtual method 'boolean…
-
0
votes0
answers35
viewsIntent Kotlin receiving null value
I have the following Intent of an Activity: val intent = Intent(this, FormCadastroUsuario::class.java) intent.putExtra("email", email) startActivity(intent) And to receive in another Activity, I…
-
0
votes1
answer122
viewsVariable "initializer is Redundant"
hello good day I am starting my studies in Kotlin but when I declare the variable is accusing that the variable is redundant package com.example.calculadoraaposentadoria import android.app.Activity…
kotlinasked 5 years, 6 months ago Anderson Rufino 1 -
0
votes1
answer55
viewsI’m not getting to finish the Activitys
My problem is this... I have 3 Activitys: (Activitya), (Activityb) and (Activityc) From Activitya to Activityb I do the following: val intent = Intent(this, ActivityB::class.java)…
android android-studio android-activity kotlin android-intentasked 5 years, 4 months ago Carlos Henrique 9 -
0
votes1
answer38
viewsHow to add a Chip (Filter type) dynamically (via code) ? (Kotlin)
I need to add Chips Filter type (image below) dynamically Attempt 1 I tried to create the Chip in a totally dynamic way: fun onAddChip(name: String){ val chip = Chip(this) chip.TYPE = Filter //Eu…
-
0
votes1
answer73
viewsError while downloading intellij
I’m trying to download intellij but every time I set up and start a new project of this error: Could not open init Generic class cache for initialization script 'C: Users Allan Appdata Local Temp…
-
0
votes3
answers87
viewsIn the Kotlin language, how to access a public variable that is in one class, through another class?
WHAT I DID: I created a class in android studio and I did it using Kotlin, and within this class I created a "public" variable like string, asseguir: var variavel_de_tipo_public_string : String =…
-
0
votes0
answers36
viewsConvert Date Kotlin
Next, I get a data json from an api: "data": "2021-05-03T14:07:19.000Z" need convert to show user... I made my data class with her: Data : Date no Adapter called it with a function that goes back to…
-
0
votes0
answers23
viewsExpected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 Colum 2 path
I am trying to consume data from an API using retrofit, but whenever I try to connect it returns this error. I realized that an array would be expected but the API is returning an object. But I’m…