Questions tagged [kotlin-android-extensions]

Questions related to Kotlin Android Extensions

Kotlin Android Extensions

721 questions
5
votes
1 answer

Android Kotlin Extension super calling

i am a Java Android Developer and i'm approaching to Kotlin I have defined the following class: open class Player : RealmObject() { ... } And i defined the following two extensions, one for the generic RealmObject class and one for the specific…
5
votes
3 answers

Fetching a URL in Android Kotlin asynchronously

So I'm trying to write a very simple Android app that fetches a response from a URL when a button gets pressed. The kotlin Android extensions have been advertised as a drop-in replacement for the boilerplate necessary in Java, so I tried my hand.…
Alex S
  • 1,027
  • 1
  • 10
  • 17
5
votes
1 answer

What is the difference between arrayListOf and mutableListOf , which one is better?

I am trying to use collections in Kotlin and got confused between arrayListOf and mutableListOf, which one should we use and why?
shekar
  • 1,251
  • 4
  • 22
  • 31
5
votes
1 answer

Could not find class 'kotlin.jvm.internal.DefaultConstructorMarker'

I am currently working on an Android app which is coded in Kotlin. Everything was fine until yesterday, at some point I started to have this error in the logcat and, when this happens, the content of the app is not displayed. Here's the long…
bontoJR
  • 6,995
  • 1
  • 26
  • 40
5
votes
2 answers

Parsing xml kotlin android

I have xml like this: Сегодня вас могут здорово огорчить. Если от расстройства все начнет валится из рук, просто спокойно сядьте и тихонько подождите хорошей новости. Сегодня у вас могут…
g71132
  • 671
  • 2
  • 10
  • 17
5
votes
2 answers

StackOverflowError using Singleton in Kotlin

Can anyone tell, why I'm getting a java.lang.StackOverflowError using this Kotlin class? Line 41 is if (instance == null) { class TokenHelper protected constructor() { var token: String? = null var appId: String? = null var…
user3105453
  • 1,881
  • 5
  • 32
  • 55
4
votes
0 answers

flutter project - calling kotlin native code to flutter

hi im getting this error while putting a native code to flutter native side . seems like a java error but i tried several methods to clear out the error but couldn't do it . now i'm getting this error FAILURE: Build failed with an exception. * What…
4
votes
2 answers

Testing involving MutableSharedFlow - java.lang.IllegalStateException: This job has not completed yet

Apologies for what is probably a very amateur question. I'm getting to grips with flows and having issues with testing where MutableSharedFlow is concerned. The following is the simplest example I can construct that recreates the…
4
votes
2 answers

Android studio: Kotlin scope functions Unresolved reference. But Project compiles

I am facing this strange issue where my project compiles and runs successfully but in my kotlin scope functions red errors are coming. It also shows errors on some of the kotlin functions like toLong(), toDouble() etc. and I have this in my gradle…
ice spirit
  • 1,425
  • 3
  • 16
  • 32
4
votes
1 answer

Kotlin View Binding java.lang.IllegalStateException: view must not be null inside listener

I'm using View Binding from Kotlin Android Extensions: import kotlinx.android.synthetic.main.fragment_user_profile.* I want to display a value from Cloud Firestore in a fragment: FirebaseFirestore.getInstance() .collection("users") …
4
votes
2 answers

Any way to change names for auto-created views by kotlin-extensions?

I'm new in Kotlin. I've red https://kotlinlang.org/docs/tutorials/android-plugin.html and noticed that views can be auto-binded to activity via importing kotlinx.android.synthetic.main.activity_main.*. If I declaring view with id = "btn_login" in…
Sergey Shustikov
  • 15,377
  • 12
  • 67
  • 119
4
votes
4 answers

Could not find method androidExtensions()

I want to use the features of kotlin @Parcelize, I have apply the plugin: 'kotlin-android-extensions' on gradle, and I added androidExtensions { experimental = true } but errors continue to appear.this error message : Error:(28, 0) Could…
4
votes
2 answers

Kotlin databinding with extension methods

I'm trying to use Kotlin extension methods inside Android's databinding. For example; calling an onclick handler. So I've made this code: posttest_list_item.xml
4
votes
2 answers

How to add Body in Url in Volley request in Kotlin?

Here is my Code that for Volley Request:- val searchRequest = object : JsonArrayRequest(Request.Method.GET,url, Response.Listener { response -> val result = response.toString() }, …
4
votes
2 answers

How to parse below Json data in Kotlin?

I need to parse this information- [ { "artist": "12", "image": "23" }, { "video_id": "12", "video_title": "23" }, { "video_id": "12", "video_title": "23" }, { "video_id": "12", "video_title": "23" }, { "video_id":…