kotlin's questions - Finnish 1answer

0 kotlin questions.

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> { ...

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'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: ...

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) { ...

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" ...

I've been searching on the internet about how to implement a SearchView that could filter a RecyclerView and every tutorial shows how to do so in an activity, but in this case I'm using a TabLayout ...

Because Kotlin doesn't support multiple catch like java does, I want to create extension to partially solve the problem. fun <T: Throwable> (() -> Unit).catch(vararg exceptions: KClass<T&...

I have defined the following function: inline fun <T> T.tryTo(block: T.() -> Unit): T? { try { block() } catch (ex: IllegalArgumentException) { return this } ...

I am stuck with a very annoying issue. I want to create an Observable that emits some values after the initialization of some component. The problem is that the other component behaves strange and ...

I am new to kotlin programming. What I want is that I want to remove a particular data from a list while iterating through it, but when I am doing that my app is crashing. for ((pos, i) in listTotal!...

I am trying to add a kotlin class for an existing java project. I have replaced a java class with kotlin class and it works fine in the Intellij IDEA when I right click and say "recompile". But when I ...

I'm having some trouble asking for the location permission. The activity extends AppCompatActivity This is the request if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission....

I have migrated my application from Java to Kotlin. In Java, the copying was working just fine. However, when migrated to Kotline it was not working. After that, I cam to know about copy method in ...

if (null != (characteristic = mTargetPeripheral.getCharacteristic(GattUUID.Characteristic.BatteryLevelCharacteristic.uuid))) I am getting this error **Assignments are not expressions, and only ...

Say I have a variable activities of type List<Any>?. If the list is not null and not empty, I want to do something, otherwise I want to do something else. I came up with following solution: ...

I want to deserialize data from firebase firestore to a model (Foo) data class Foo( var timestamp: Int = 0, var title: String = "", var question: String = "", var ...

I want to get a string extra in another activity from an intent. This is the way to create my intent val intent = Intent(this, Main2Activity::class.java) intent.putExtra("samplename", ...

I have a form that it could be submitted and send the data to an API, so when I receive the callback of request done I would like to hide the form and show a view of thanks. This is my layout : <?...

I'm trying to create a View that will be used to Log all MotionEvent. This View is in a Service() which is linked to the App from where I need the events to be logged. My problem is that when this ...

I'm tring to get the response of a callback in sync mode because I the value of the response is needed to all application to work, without this value ( token ) I can't continue to use the application. ...

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....

I'm using Dokka v0.9.17 for Android. When I run ./gradlew dokka it generates the docs but it include so many packages that I don't care about like android.support.fragment and packages for all the ...

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 ...

My projects Map activity is not working I just pasted the api key in place google_maps_api.xml and clicked run Logcat: E/AndroidRuntime: FATAL EXCEPTION: Thread-5 Process: com....

I have a multiline EditText like this <android.support.v7.widget.AppCompatEditText android:id="@+id/et_msg" style="@style/commonEditStyle" android:layout_width="match_parent" ...

The Code A works well, but I get error when I replace import android.preference.DialogPreference with import android.support.v7.preference.DialogPreference why? Error onCreateDialogView() override ...

I want to upload my Jacoco test report to Coveralls automatically after my Travis build finishes. It works for Java, but how to configure it for Kotlin? Error message I can generate a Jacoco test ...

I am trying to save data in Room and it requires some background thread to save data. So I have created an observable like this val obs: Observable<MutableLiveData<List<Source>>>? = ...

So, hello guys,in android-studio, I've got a horizontal-linear-layout and also got two buttons in it side by side which are togglebuttons, lets call them X and Y, what I'm trying to do is, once I ...

Related tags

Hot questions

Language

Popular Tags