kotlin's questions - Norwegian 1answer

0 kotlin questions.

I was wondering what would be the correct declaration for a long running task. suspend fun methodName(image: Bitmap?): String? = async { // heavy task }.await() OR fun methodName(image: Bitmap?)...

So i am facing this issue whenever i try to run my app Error: 06-19 13:12:04.579 2944-2944/com.abhishek.tracker E/AndroidRuntime: FATAL EXCEPTION: main Process: com.abhishek.tracker, PID: 2944 java....

I use immutable data-structures as much as possible, because it's really easy to work with them. The problem though is when two threads modify the data-structure. In that case, the synchronized ...

Actually I don't need this feature and asking just out of interest. With C language it's possible to use assembler code within source code. Is it possible with Kotlin? For instance, define inline ...

I have a module with annotation processor which generates quite lot of classes I use throughout the project. I used that module in one of my projects, though it was hell to make it work properly, it ...

I want to group timestamps by a period of time spliting up by: (endDate - startDate) / (selected_amount_of_intervals): In this case we have selected_amount_of_intervals = 10 var example = with(A) { ...

When using LinearStateQueryCriteria, Supposing I have the following states all having the same linearId, S4 (unconsumed) created at t4 S3 (consumed) created at t3 S2 (consumed) created at t2 S1 ...

I am writing my first Android application in Kotlin. I was wondering how to instantiate a Room Persistence database so that I can access it from many different activities. Sorry if my question is dumb ...

In Kotlin we have this notion of immutable properties. I once heard that in functional programming, state should not be changed. I have been thinking about this in the context of domain models. ...

I have an app that shows a calendar (at the moment, I am using Material design calendar view) and I need to highlight several days in the calendar with different colors (I will have several lists of ...

I've created sample class to test assertions in Kotlin class Assertion { fun sum(a: Int, b: Int): Int { assert(a > 0 && b > 0) return a + b } } fun main(args: ...

I have an interface in my Adapter class: interface OnItemClickListener { fun onItemClick(view: View) } TAKE NOTE that my interface is in Kotlin. which I want to set via this method: public fun ...

How to iterate over HashMap in Kotlin? typealias HashMap<K, V> = HashMap<K, V> (source)

I'm trying to implement a DB Observer with LiveData as described in the android documentation. As long as I'm programming in Kotlin I'm adapting the functions (originally written in Java) to it. ...

I have implemented this interface in my Adapter in Kotlin: interface OnItemClickListener { fun onItemClick(view: View) } public lateinit var onItemClickListener: OnItemClickListener public fun ...

I have got an error about no such talbe: Account while I am calling data from database. My database name is "account.db" and table name is "Account". There are two columns, first is "name" and ...

When trying to create a Toolbar using android.support.v7.widget.Toolbar, I get an error saying function invocation '(Toolbar(...)' expected. I'm using the suggested android.support.v7.widget.Toolbar ...

I am getting the following error while building the project. haven't used CoordinatorLayout in this project. just added as a dependency in build.gradle : I am using Android Studio 3.2 Canary 4. ...

I am using Bluetooth LE for fetching surrounding devices but I am not getting a list and also I am getting Runtime Exception here is stack-trace 06-18 13:59:33.188 10189-10189/com.labs.aress....

My current class is below : class MyGcmListenerService : GcmListenerService() {} GCMListenerService is as below public class GcmListenerService extends zzb {} Now i'm looking to extend to another ...

I have a Spring Boot 1.5.x project where some @Component depends on other @Component, and ultimately along the chain of dependencies, some @Component can be enabled or disabled completely using @...

I have a project which is primarily written in Java but I'm slowing moving to Kotlin for the new activities. This project applies Dagger2 and work perfectly when used with Java based activities. ...

let's say I use a jar that IBM has created. Let's say that this Jar has a function that I need but is ultimately build as such: while (true) { System.out.println(1) } (of course it doesn't ...

I added on click animations on some button items from a recycle view. Everything works smoothly, however when I scroll down the list some buttons appear in a weird state like they were frozen during ...

When I switch in an Android project with classpath 'com.android.tools.build:gradle:3.2.0-alpha18' to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50" I run into What went wrong: ...

Say I have this block of code: val cmd: CommandLine try { cmd = parser.parse(options, args) } catch (ex: ParseException) { // do stuff } // error: cmd is not initialized val inputArg = cmd....

I want to make void enqueue(Callback<T> callback); method invocation code block more expressive, Here is what I have an usually request.enqueue(object : Callback<MyModel> { ...

I'm working on a Kotlin application with a JavaFx UI. I have hidden the stage and when I want to show it from another thread it doesn't show! The main function tries to write some data to a socket. ...

I am using Firebase Firestore and I'm facing a problem with the read operation: I use an onCompleteListener, and inside there, I call different callbacks if the operation was successfull or not. The ...

I'm making an application in Android Studio and keep getting a "java.lang.VerifyError". It's on a class (class Place) I made that I've declared with @Parcelize to pass an ArrayList containing Place ...

I'm trying to create my first app in Android Studio with Kotlin. The installation worked fine. However if I drag any element onto the Layout, it's not showing up properly. The only change I can see, ...

I think this issue probably has to do with my Mongo Document Koltin Data class, but for our business case we need to allow the user to add on any JSON fields to describe their RF data set. ...

I'm trying to learn how to implement Retrofit2 and Moshi inside the Kotlin programming language. However, I seem to be having trouble trying to compile my code. I define the following data classes/...

The following code doesn't compile, although the documentation says it should be as simple as this: override fun onResume() { super.onResume() async { Log.d("foo", "async") } } ...

try { } catch (ex: MyException1, MyException2 ) { logger.warn("", ex) } or try { } catch (ex: MyException1 | MyException2 ) { logger.warn("", ex) } As a result, a compilation error: ...

Firestore here explains, how I can use simple classes to directly use them with firestore: https://firebase.google.com/docs/firestore/manage-data/add-data How can I mark a field as excluded? data ...

I'm trying to create a test using JUnit and Mockito for the following scenario: make a call to the server, in case the response is not successful, retry the request. repository.uploadModel(model) ...

I'm trying to get a state using it's linearId, but apparently my list is empty, maybe the issue is in the way I'm searching for it. When I get the states from the vault using rpcOps, I can see that ...

This is the timestamp format I need: 2018-03-22 19:02:12.337909

I want to know how to add multiple click events to buttons defined in XML, as previously, in Java, we implemented View.onClickListener interface and did the rest of the work in onClick method. Example:...

I'm working on a ListView: I just want to simple edit some things in the design of my listview, as changing the size of the text, center it, etc. I have read that since I'm using the "...

This is a followup for these questions: Kotlin doesn't see Java Lombok accessors? Is kapt supported in maven? It seems that the kapt has evolved since and now it is even supported in Maven. I am ...

I have a CropViewActivity that crops an image, saves the cropped image to the external storage. The process of decoding the bitmap and saving it to external storage is done in another thread. So the ...

Recently we upgraded one of our enum class to sealed class with objects as sub-classes so we can make another tier of abstraction to simplify code. However we can no longer get all possible subclasses ...

I'm in the process of wrapping my head around Architecture Components / MVVM. Let's say I have a repository, a ViewModel and a Fragment. I'm using a Resource class as a wrapper to expose network ...

I found warning in Kotlin Compiler settings Following modules override project settings: app Project compiles and works perfect but can this warning make affect in future? And how to solve this. ...

class Eco9 : AppCompatActivity() { lateinit internal var uri: Uri override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R....

I would love to understand better how Ktor is handling the routing for static content. I have the following hierarchy in my static folder (working directory): - static - index.html - (some files) -...

I expect the following to produce a compilation error, but it doesn't. Any ideas why? fun <T, U: T> foo(a: T, b: U) { println("$a $b") } foo("bar", 123) If I call foo() with explicit type ...

I'm trying to list all BLE devices on an Android device, using Kotlin (the Java-version don't work either) but I don't get any devices or any call back at all, except for a "scan was already started" ...

Related tags

Hot questions

Language

Popular Tags