Skip to content
Advertisement

Tag: kotlin

How to set text color of bottom navigation item selection and unselection?

I was trying to set the following attribute of BottomNavigationView widget But this sets the text color of active and inactive item both. I want to have different text color on active and inactive item of BottomNavigationView. Answer First, you have to make a selectable color in res>color>selectable_color Then you have to set this selectable color as itemTextColor in BottomNavigationView

Type com.example.myhouse.MainActivity is defined multiple times

Error while compiling the code. Type com.example.myhouse.MainActivity is defined multiple times: C:UsersHPAndroidStudioProjectsmyHouseappbuildtmpkotlin-classesdebugcomexamplemyhouseMainActivity.class, C:UsersHPAndroidStudioProjectsmyHouseappbuildintermediatesjavacdebugclassescomexamplemyhouseMainActivity.class Gradle file Answer Just delete build folder of appmodule and Rebuild the project! or Try to invalidate cache and restart This will fix the issue!.

How to download a file when a custom header is needed?

I want to download from a private repository in GitHub, so I need to pass the headers Authorization: token ${GITHUB_TOKEN} and Accept: application/vnd.github.v3.raw. For example, with curl: curl -H “Authorization: token ${GITHUB_TOKEN}” -H ‘Accept: application/vnd.github.v3.raw’ -o file.yaml -L https://api.github.com/repos/<owner>/<repo>/contents/file.yaml Looking for information about how to download a file in Kotlin, I found a few examples, and I’m using the following:

Why is Java Sound API frame position getting stuck?

I’m trying to create a sound recorder using Java Sound API on Kotlin Desktop. I want to automatically stop the recording after 3 seconds. The frame position does initially advance but then gets stuck. This is output of the print statement: What is causing this and is there a way to fix it? Answer The problem was that AudioSystem.write needs

AuthComponent doesn’t have a @Subcomponent.Builder, which is required when used with @Module.subcomponents

I am learning Dagger 2 from this site https://developer.android.com/training/dependency-injection/dagger-android. I am creating like this, Appcomponent.java AppModule.java AuthComponent.java AuthModule.java But I got the error,AuthComponent doesn’t have a @Subcomponent.Builder, which is required when used with @Module.subcomponents @Module(subcomponents = AuthComponent.class)I am doing as the documentation. Please help me explain with my error. Edit This is my dagger version. Answer As expected, your code

Advertisement