Category "kotlin"

Parcel a List of objects from another Parcelable class in Kotlin

I'm working on a weather app for a class and I'm having some trouble with parcelable. I've looked at several other questions that are similar to this on StackO

pointerInput of Modifier takes no actions

I need a Card() Composable with a normal press and a long press functionality for a custom Card Composable. The thing is Card() has its own value called onClick

E/RecyclerView: No adapter attached; skipping layout . Adapter doesn't want to be recognized/detected

I'm really sorry for asking the same question like 100 other people did but i have tried every solution provided and I can't seem to find what is wrong with my

Jetpack Compose TopAppBar with dynamic actions

@Composable fun TopAppBar( title: @Composable () -> Unit, modifier: Modifier = Modifier, navigationIcon: @Composable (() -> Unit)? = null,

How support PhoneStateListener for APIs below 31?

I have discovered that the code of my application has been deprecated. I was using PhoneStateListener class but now I see that this decreasing for API 31 and th

Duplicated class Koin org.koin and io.insert-koin

I'm using two library that have dependencies of two different versions of Koin. One of the library has org.koin:koin-android:2.0.1 and the other has io.insert-k

Convert EditText to TextView Programatically? [duplicate]

What I Want I want to convert EditText into TextView programmatically. <EditText android:id="@+id/inputValue" android:layout_width=

How to add SafeArgs to new top level Kotlin gradle

I m gonna use Navigation Framework with fragments but at the dependency step, when i tried to add SafeArgs from documentation i see that the new top level gradl

Kotlin: issue with NestedScrollView with RecyclerView loading all data at start

I have a fragment that has multiple elements in it, some textViews, imageViews, a page ViewPager for ads and at the bottom I have a recyclerView. I want them a

Need help changing the button text using Android Studio

Sorry if asked before, but I don't find a solution on the web. As mentioned in the title, I don't know how to change the button text on this app (screenshot) th

If val variables are immutable how I was able to change its value?

class Mobile(val company: String= "unknown", var model: String ="unknown") { fun call(mobile: Mobile) = "Calling with ${mobile.model} from the company ${mobile.

Post request a raw json with Ktor client

I want to make post request with Ktor but I get Error 400. the curl looks like this : curl --location --request POST 'https://api.jdoodle.com/execute' \ --heade

Cannot deserialize XML object to data class using JacksonXml

I'm attempting to deserialize this xml string: val xml2 = """ <id>3</id> """.trimIndent() to this data class @JacksonXmlRootElement(localName = "

LazyColumn that respects MotionEvent.ACTION_SCROLL

How to force compose' LazyColumn to act like traditional scrollable elements like RecyclerView or ListView? Useful when want to scroll with mouse, e.g. with vys

kotlinx.serialization.json.internal.JsonDecodingException: Polymorphic serializer was not found for missing class discriminator ('null')

I am using sealed class to handle api response. I am trying some code but getting some error of serialization. I tried this solution as well but it not working.

Kotlin Mockito Generics

Suppose my class is: open class TestThis{ @Autowired private var myService : MyService? = null fun doMyFunction(){ val result = myService.d

How to observe ContentProvider changes for coroutine flow

I have a flow to fetch data from database via content provider. fun getDataFlow(): Flow<Result> { return flow { emit(Result.Loading) // f

Is there a way to force using annotation only on a var property

I'm making an annotation processor for encrypting personal data due to law. So in order to encrypt those field it should be able to set new value so I want my a

Hilt Unsupported metadata version in Kotlin

I was tried to run my code in Kotlin 1.5.10 With plugin as plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' id 'dagger.hilt.android.p

How to make item selectable in recycler view and use it?

I have followed android developer documents to create the recycler view. But now I would like to make the item selectable. Currently have created itemAdapter.kt