Category "kotlin"

NPE: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference

I've this basic app called Navigation that I was trying to make to understand some concepts where there are 2 activities MainActivity and ActivityB MainActivity

How to throw Custom exception in ktor

Hey I am working in ktor. I want to throw exception in ktor. I am reading this doc and this example. I want exception, responseCode and errorResponse with error

App Crashes when Room DB Entity Class object boolean value is changed to false

I have a Room DB setup in my app and it was working well until recently when the app started crashing. It happens that I have a boolean value as a field in the

Why @JsonIgnore annotation doesn't work during deserializing data?

I have a data https://gist.githubusercontent.com/iva-nova-e-katerina/fc1067e971c71a73a0b525a21b336694/raw/954477261bb5ac2f52cee07a8bc45a2a27de1a8c/data2.json a

How to match color attributes between theme and icon in Jetpack Compose?

I have a vector drawable which has two paths with different attributes referencing to different theme colors. And these attributes' values are being changed by

Stopping Exoplayer on swiping in viewPager

I am making a reels type app. I have made a ReelsFragment and ReelsAdapter. I have used View Pager 2 to swipe views vertically. I am using Exoplayer to play vid

Caused by android.app.ForegroundServiceStartNotAllowedException startForegroundService() not allowed due to mAllowStartForeground false

I have upgrade the Android SDK project 30 to 31. Also i am using the the Android Beacon Library for scanning the the iBeacon. Android 12 i am getting the frquen

Recycler View life cycle methods

The flow of recycler view function call is: getItemCount() -> getItemViewType() -> onCreateViewHolder() -> onBindViewHolder() The size of array list i

Data not visible

My Variable Class data class QnaVariable( val questionOne: String, val answerOne : String, val questionTwo: String, val answerTwo : String) My ViewModel Class

Background Location with workmanager

How to get the location while app is in background periodically and execute some task supportive with android 12 ?

Android check internet connection in kotlin

I need to check if the device have internet connection, I search for some examples but when i copy and paste the code i always get errors or deprecated function

no build output compiled for common module of Kotlin Multiplatform project

I'm trying to figure out why dependent projects for my Kotlin MPP library don't see any provided modules in their common modules even though the targets (jvm, a

ClassNotFoundException in navigation graph android

I saw this crash over firebase and it is not reporducible in the emulator of same OS. Not sure what is causing it. Crash is occuring in samsung M32 OS 11. The c

How to compare date and time in kotlin android?

I have an app on the PlayStore and I am building a feature where the user will not see ads more than a specific number in one day. I am thinking about comparing

Using rememberCoroutineScope() vs LaunchedEffect

Context In Jetpack compose, we have the option of using rememberCoroutineScope() as well as using the LaunchedEffect composable in order to use coroutines / run

Module was compiled with an incom patible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.0

My app compiles, but after looking into a few related questions like (Module Error "Module was compiled with an incompatible version of Kotlin. The binary versi

An alternative solution to set negative padding values in Jetpack Compose? (java.lang.IllegalArgumentException: Padding must be non-negative)

I'm trying to assign a negative value to the padding modifier but the app had crashed. Have a look at my code. Thanks if you can help or give me an alternative

How to show Toast Message with Binding Adapter

I dont see Toast Messages. I want to show a toast messagges when click userAddFavoriteButton.. @BindingAdapter("addFavorite") fun bindAddFavorite(userAddFavorit

My MutableStateFlow doesnt emit when called from suspend function in test

I am trying to write tests for my Repository which provides access to my Room database. For this, I wrote a Mock Database and a mock DAO: My Database: abstract

Dagger - Hilt : Do we need to mark all activities with @AndroidEntryPoint

So my question is as I am getting started with Hilt, do we need to mark all activities with @AndroidEntryPoint annotation or can we just create a BaseActivity a