Questions tagged [kotlin-android-extensions]

Questions related to Kotlin Android Extensions

Kotlin Android Extensions

721 questions
20
votes
1 answer

Propertly would not be serialize into a Parcel in Kotlin

I wish to have my variables that are not from my constructor, part of my Parcelable. However, I face this warning "Propertly would not be serialize into a Parcel", that inform me I can't do that currently. I am using Kotlin in experimental…
Guillaume agis
  • 3,756
  • 1
  • 20
  • 24
19
votes
1 answer

What is the difference between Dispatchers.Main and Dispatchers.Default in Kotlin coroutines?

What is the difference between Dispatchers.Main and Dispatchers.Default in Kotlin coroutines? I used viewModelScope.launch {} and launch block as expected is executed on UI thread. Then I discovered that it defaults to…
19
votes
3 answers

ActivityMainBindingImpl cannot be found

This is from the google site: A binding class is generated for each layout file. By default, the name of the class is based on the name of the layout file, converting it to Pascal case and adding the Binding suffix to it. The above layout filename…
19
votes
1 answer

Kotlin synthetic extension for view

I have a layout with some views, one of them has the id title_whalemare import kotlinx.android.synthetic.main.controller_settings.* import kotlinx.android.synthetic.main.view_double_text.* class MainSettingsController : BaseMvpController
whalemare
  • 1,107
  • 1
  • 13
  • 30
19
votes
2 answers

Kotlin synthetic extension and several include same layout

How to access to view using kotlin synthetic extension if I have a layout like below: file:two_days_view.xml
LunaVulpo
  • 3,043
  • 5
  • 30
  • 58
18
votes
4 answers

how to instantiate an object from a class in kotlin

I am learning Kotlin, and I googled how to create a class in kotlin. So, I created the below class as a test. In the main activity, I am trying to instantiate an object from the class Board, but i get the following error: classifier Board does not…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
18
votes
1 answer

Kotlin Android Extension layouts from library module cannot be resolved

I have my buyer, seller module and a common module. Few layouts which are used in both buyer and seller module are placed in common module. common -> layout_toolbar.xml buyer -> activity_sell.xml ->
Chandra Sekhar
  • 18,914
  • 16
  • 84
  • 125
18
votes
7 answers

How to setOnNavigationItemListener on BottomNavigationView in android using Kotlin?

I use kotlin-android-extension and I can call bottomNavigationView id from layout file to kotlin file. I can use bottomNavigationView.setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener {}), but whats next? As…
j.elmer
  • 1,441
  • 2
  • 17
  • 36
17
votes
7 answers

could not find extension implementation class org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRootsManager

My project works and builds successfully on my Mac but I cloned from github and although Android Studio appears to work normally, the project wouldn't build. I setup this project using Kotlin DSL. Gradle sync failed: could not find extension…
17
votes
4 answers

Required lifecycle owner found Activity

I am using android library androidx.appcompat:appcompat:1.0.2. Working on a sample of codelabs work manager. I need to get live data from ViewModel and I am using this mViewModel!!.getOutputWorkInfo()?.observe(this, Observer> { …
17
votes
1 answer

Kotlin class does not get its boolean value from firebase

I have my kotlin class as class Center : Serializable { var active: Boolean? = null var address: String? = null var isJobAccessGranted: Boolean? = null } here is how i am getting value //from java class @Override public void…
17
votes
3 answers

Kotlin custom dialog Parameter specified as non-null

I got this error : Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState When i am trying to inflate a custom…
omer tamir
  • 314
  • 1
  • 3
  • 11
16
votes
4 answers

Migrate to Jetpack compose error: Unbound symbols not allowed

I wanted to migrate my existing project to partially use Jetpack compose for it. So I opened it using Android studio 4.2-canary9 and added a compose activity so that Android studio adds needed configurations needed. When I tried to run the project…
16
votes
3 answers

Class X is not abstract and does not implement fun writeToParcel() defined in android.os.Parcelable

In my Android app, I want to add a Bundle including a Place object described below to my Intent. Since serializable was slow and not recommended, I preferred Parcelable. Althoug I use Kotlin 1.3.31, I have problems parcelizing some data classes.…
16
votes
4 answers

Function in Kotlin data class as argument leads to parceling error

I have a data class in Kotlin hat is using the @Parcelize annotation for easy parcelization. Thing is I now want to pass a function to this class and I do not really know how to make the function not be considered during parceling. This is my data…