返回首页
We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [kotlin]

Kotlin is an open-source, statically typed programming language backed by JetBrains. Kotlin combines OO and functional features and is focused on interoperability, safety, clarity, and tooling support. It currently targets the JVM and JavaScript, and it's an officially supported language on Android.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

Android SeekBar: with 2 thumbs

Hi does anyone knows how to do this: I tried several libraries and didn't work. Does anyone have an idea how to do it?
0
votes
0answers
6 views

package.json into jar gradle 6 build kotlin multiplatform 1.3.50

I use gradle 6 to build my kotlin multiplatform 1.3.50 project. The versions are important, a lot of things are changing for both gradle and kotlin multiplatform this last months. Mostly, now kotlin ...
0
votes
0answers
5 views

Kotlin Native cinterop def file: how to eliminate absolute path?

When specify linkerOpts, we need set absolute path for -L option, but it's easy to break. In older version, setting linkerOpts in build.gradle could work, but in 1.3.50, it warns that "-linker-option(...
0
votes
1answer
17 views

Kotlin draw linear gradient relative to shape

I have a Paint object that contains a linear gradient like this: init{ this.myPaint.shader = LinearGradient(0f, 0f, 0f, 15f, 0xFF1F9928.toInt(), 0xFF184F1E.toInt(), Shader.TileMode.MIRROR); } ...
0
votes
1answer
28 views

Android EditText MultiLine with Sentence Caps

I am trying to instantiate an EditText with mutli-line capability as well as the first character capitalization flag, like so: myEditText?.setSingleLine(false) myEditText?.inputType = InputType....
0
votes
0answers
11 views

session the installation did not succeed the application could not be installed

I updated my Android studio and no project is installing again. i have rebuild, cleaned cache but nothing. See the error Installation did not succeed. The application could not be installed. ...
1
vote
2answers
51 views

Pass null to non-nullable Java method from Kotlin

Suppose there is Java library that's declared @NonNullApi, but some its methods actually may consume null parameter. Is there way to ignore non-nullability requirement and pass null there from Kotlin?...
0
votes
0answers
14 views

Mocking suspend function with Mockito returns null

I have the following classes interface CarsApi { suspend fun fetchCar() : Car } class FetchCarUseCase(private val carsApi: CarsApi) { suspend fun execute: Car = withContext(...
-1
votes
0answers
9 views

I want to play 24bit PCM raw data in Android either using android.media.AudioTrack or libvlc . Any option is fine [on hold]

We're receiving 24bit PCM Raw data 96KHz from USB Audio(UAC) . I want to play in android either using Android AudiTrack or using libvlc . I have tried using libvlc and its playing but at that time I ...
1
vote
1answer
30 views

Unable to Log certain lines

My onCreate() of MainActivity contains this part of code: val weatherService = RetrofitFactory.retrofit(AppConstants.OWM_API_URL) .create(OwmApi::class.java) GlobalScope.launch(...
2
votes
1answer
57 views

How to simplify chain of predicates in Kotlin

I have a chain of predicate clauses, something like this student?.firstName?.equals("John") ?: false && student?.lastName?.equals("Smith") ?: false && student?.age?.equals(20) ?: ...
0
votes
1answer
33 views

requireActivity() or get application context when instantiating WorkManager in fragment

I've been doing some with a fragment that has a view model with a dependency on the WorkManager. I used to get the WorkManager using the now deprecated method WorkManager.getInstance(), so I ...
-2
votes
1answer
66 views

Initialize abstract class in Kotlin

I am working on kotlin project where I need to initialize abstract class , I can achieve this easily in java but not able to do it in kotlin , what is correct way to achieve this . for example in ...
0
votes
1answer
23 views

Libgdx stage add actor low FPS

I'm using ApplicationAdapter. When I have the code below in create() method, my fps is always about 14. for (i in 0..1000) { stage.addActor(Food( Food....
-1
votes
5answers
41 views

How to pass data from Activity to fragment using OnFragmentInteractionListener

I have Main activity and it have 3 fragments inside tab layout. i have to call api from activity and pass data to all three fragments after successfull response. After data passed i have to show data ...
0
votes
0answers
14 views

Translate a native query to Spring mongo data aggregation framework

There is any way to run a native mongodb aggregation with Spring Boot Data? In other case I would like transform the native query into Spring Boot Aggregation Framework, but I don't get at all: ...
0
votes
3answers
42 views

Language Agnostic - Allowable types in function and constructor parameters

Most, if not all statically typed languages allow you to specify a single type for a function or constructor parameter; for example function foo(x: string) { ... } foo("hello") // works foo(123) ...
0
votes
0answers
9 views

Assign a new translate xml android:duration value from kotlin

I want to change some attribute values in xml. Let's say if an anim xml, which has tons of animations in it and an attribute android:duration="1000", is used on a view id/myView_01, then I want to ...
0
votes
0answers
19 views

How can you draw a straight line between 2 Points on a Mapbox map?

I have loaded a Mapbox map in my Fragment: xml <com.mapbox.mapboxsdk.maps.MapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" ...
-1
votes
0answers
21 views

Download file from URL using micronaut [on hold]

I'm trying to download data DB in the .mmdb format from URL. Unfortunately I couldn't find how to do this properly in Micronaut documentation. Could someone be so kind and provide an example. Thanks ...
1
vote
0answers
25 views

when the thread will suspend a suspend-function?

I am just learning about Kotlin's Coroutines, and I'm curious when the thread will suspend a suspend-function. In Golang, we know it will suspend a goroutine in several cases; calling another ...
0
votes
1answer
26 views

Kotlin Swap Elements Between Two Arrays WRT To Object Field

I have two ArrayLists that contains a custom object: class MediaData(val path: String,val durationMs: Int) Due to internal complications that are out of topic to this question, I need to swap ...
0
votes
2answers
55 views

What happens when the user leaves the app in the middle of a function?

Trying to understand a bit more about the Android lifecycle. Consider 3 functions: MyFragment(): Fragment(){ private fun something(){ // stuff **user leaves app** // ...
0
votes
0answers
24 views

Initial values from Room in TextInputLayout

New to android development in general an in kotlin in particular. Maybe I was too ambitious beginning with an app made in kotlin with MVVM philosophy and databinding (but kotlin codelabs looks great!)....
0
votes
0answers
17 views

Koin Moduledefinition on KoinTest

I try to use on a unit test (Kointest) my ModuleDefinition object (not Koin Module) but KoinTest only let me use the Object "Module". If a try this: startKoin { modules(uiModule) } The error ...
0
votes
2answers
39 views

add data to an arrayList, when If condition is satisfied in nested for loop in Kotlin

Check the code below: getCommonsArrayList(listA:ArrayList< User >, listB:ArrayList<User>):ArrayList<User>{ var listCommon = ArrayList<User>() for (i in listA....
0
votes
0answers
11 views

Kotlin Coroutine - Ktor Server WebSocket

I made a kotlin-ktor application, what i wanted to achieve is that it is modular that anytime any pipelines inside the application maybe removed from the source code without breaking any ...
0
votes
1answer
32 views

Koin dependency override is not working in testing

I'm new to testing and I adapted Koin as my dependency injection. my application is working fine. it's still having a login function. Here's my dependency class Modules.kt val applicationModule = ...
1
vote
1answer
42 views

Not able to change language locale in Kotlin

I have 2 string files "en" and "es". When ever I am changing the locale in locale manager class, it saves the new locale successfully but does not reflect changes on refreshing activity. ...
0
votes
1answer
23 views

Send Map/JSON from Flutter to Android through Method channel

I've set up a basic method channel in Dart and Kotlin Dart Code Future<void> _updateProfile() async { try { var result = await platform.invokeMethod('updateProfile'); print(...
-2
votes
3answers
27 views

onBindViewHolder method accept first first parameter only

I am trying to make recycler view in kotlin my CustomAdapter class of onBindViewHolder method only accept first dataholder of model class. onBindViewHolder(holder: ViewHolder, position: Int) this ...
0
votes
0answers
39 views

Kotlin: Intent does not return the path

I have this code: val intent = Intent().setType("application/pdf").setAction(Intent.ACTION_GET_CONTENT).addCategory(Intent.CATEGORY_OPENABLE) startActivityForResult(Intent.createChooser(intent, "...
0
votes
1answer
39 views

Send a array in HashMap<String, String> via Retrofit

I am trying to send a post request via Retrofit in Android, but the json is being bad formatted when I put an array in the body. var data = ArrayList<HashMap<String, String>>() var ...
1
vote
1answer
19 views

Room database query returns null where it should be null-safe in Kotlin

I have a query that does not have a result, when the DB is empty. Therefore NULL is the correct return value. However, the compiler in Android Studio gives me the warning: Condition 'maxDateTime != ...
-1
votes
0answers
22 views

App force closes/crashes in Android Studio Emulator [duplicate]

The following is my first attempt at making a relatively basic calculation app. Currently I have a button in MainActivity called CLoop set to open the CLoopActivity, then the button boilerBTU in ...
1
vote
1answer
45 views

How to check and also set variable synchronously in Kotlin?

I have a mutable nullable property. I'd like to check in a method if its value is null, if so, set it to a newly created object. Then I'd call a method of the property (old or new, but existing object)...
0
votes
1answer
25 views

Android: Uncatchable exceptions with Retrofit2 and Kotlin

I just experience a very difficult problem regarding the newest Retrofit2 and Kotlin. Client wants to connect to server via retrofit2. val client = OkHttpClient.Builder() ....
1
vote
1answer
23 views

Navigation controller gets called twice inside livedata observer

What I'm trying to do is to use the Navigation controller inside a LiveData observer, so when the user clicks an item from the list it notifies the ViewModel, then the ViewModel updates the data and ...
1
vote
0answers
8 views

Kotlin package level TypeDefs for Hibernate

I have a custom type for hibernate (TipoSiNo), this is the equivalent of the YesNoType but for spanish (S/N). When using java I declared this type as the default for boolean fields in a package-info....
0
votes
0answers
45 views

How to fix deprecated issue in Android Bitmap?

hi guys someone could help me? i'm stucked with this can't find the answer selectedPhotoUri = data.data val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, selectedPhotoUri) ...
0
votes
0answers
7 views

using bassboost in service class in kotlin bassboost.strengthsupported is returning false. How to get it true?

BB1 = BassBoost(0,mp!!.audioSessionId) BB1.setEnabled(true) Toast.makeText(this, BB1.strengthSupported.toString(), Toast.LENGTH_LONG).show()
-1
votes
0answers
28 views

SQLite database not working in Kotlin, App Crashes [duplicate]

When the line val db = this.writableDatabase is executed, the app crashes. same is the case for val db = this.readableDatabase as well. This is how I am trying to use the database functionality in ...
0
votes
1answer
26 views

change highlight color of info window in Google Maps

I saw that I can override OnInfoWindowClickListener for markers, however I am unable to disable/change the color of the info window when the user clicks on it, it keeps showing the default infoWindow ...
-1
votes
0answers
29 views

Round Corners using CardView and ImageView

I am trying to round the corners of an ImageView in android xml development. I use a parent of CardView with CornerRadius and I made sure the API is above 19 to be able to use the elevation feature. ...
-1
votes
0answers
14 views

Access bottom navigation from withing fragment android

I came across problem. I know I can access toolbar from fragment, but don't know how to access bottom navigation bar, I am using new Android Architecture components Navigation UI. I need to display ...
0
votes
1answer
32 views

How to add javax.persistence.criteria.* classes to Jandex index in Quarkus?

I am trying to fix the following warning in my Quarkus application: 2019-11-17 16:21:34,191 INFO [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation 2019-11-17 16:21:34,975 WARN [io....
0
votes
0answers
20 views

Kotlin android - get row from multiline textview

Im starting to learn Kotlin and android development but have a question for which I cant find an answer online. I have a multiline textview with 4 lines/rows in it. How do I access 2nd line/row? ...
3
votes
1answer
45 views

Visibility in Kotlin coroutines

I decided to dive in into Kotlin coroutines. I have some questions regarding visibility. I understand that in absence of a ContinuationInterceptor, it is possible different sections of the same ...
0
votes
0answers
23 views

Do not add unused imports when Java is converted to Kotlin

When I paste some Java code into a Kotlin project, Android Studio can convert the syntax. However, when the converter is invoked, it adds several unused imports to the file, which broke my existing ...
0
votes
1answer
27 views

AutoRemove from list after x time is passed

I have a chatview where i store + show list of users currently typing. Server keeps updating this list (add/remove) but i didn't implement any storage for typing users in a group as it is a ...

返回首页
杏彩计划 杏彩官网 杏彩APP 杏彩走势图 杏彩下载 杏彩官方 杏彩网站 杏彩怎么玩 杏彩官方 杏彩靠谱吗 杏彩代理 杏彩骗局 杏彩投注 杏彩倍率 杏彩开奖 杏彩漏洞