2020欧洲杯手机版注册

A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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

Nav darwer takes too much space in my code. (kotlin)

Im building quite a huge app with kotlin and it has various pages etc.. and the Navigation Drawer code takes quite a bit of space, Is there any way I can take a shortcut to maybe not have to make a ...
1
vote
0answers
16 views

Obtain single user using coroutines with LiveData

What is the best way to use coroutines with LiveData for selecting some data from database using Room.This is My Dao class with suspended selection@Daointerface UserDao { @Query("SELECT * ...
0
votes
0answers
6 views

How do you close an android app after pressing back on the phone

On my app I would like to close the app when reaching the mainActivity. At the moment I have noHistory added to all activities in the manifest because I am overriding the navigation based on how I ...
0
votes
0answers
10 views

Next activity is not opening

In my project, I have two activities first splash screen and the next one is showing a list of card views, it works efficiently before I write the code for toolbar.but after I wrote code for toolbar ...
0
votes
0answers
11 views

Android: ActionBar dissapears on calling setContentView()

I make an app with theme switching. But after setting new theme, when I call setContentView(), Action bar doesn't render. Sample imageMainActivity.kt: override fun setContentView(layoutResID: ...
0
votes
3answers
25 views

UnitialisedPropertyAccessException even after lateinit var has been initialised?

I'm having issues with some Kotlin code that I have not come across before.In one activity I declare a late init variable:lateinit var currentUser : UserAnd later on initalise it. I know it is ...
0
votes
1answer
6 views

Android periodic location locationRequest.interval not working

TL;DR :Android requestLocationUpdates() has locationRequest.interval = 10000 which does not happen, is something wrong?In Details:Successfully implemented Android period location and it works ...
0
votes
2answers
23 views

Implementing two way data-binding WebView using MVVM in Kotlin

I am trying to implement MVVM in all my app and I am very new to this, so I want to load a webview through my ViewModel, but I don't know the best way how to do this, if also has a progress bar that ...
0
votes
1answer
17 views

I have child Fragment2 inside parent fragment1 and I want change fragment on back click and next time on Back Pressed I want close the activity?

For change child fragment2(container inside fragment 1 parent fragment) view.isFocusableInTouchMode = true view.requestFocus() view.setOnKeyListener(View.OnKeyListener { v, keyCode, ...
0
votes
0answers
16 views

How can I add a callBack to my WS with Kotlin

I develop an android app with Kotlin, api 28. I also use swaggerHub and swagger.json to get all WS. In swaggerHub, I export the client sdk Kotlin.After export the "Kotlin_client_generated" file with ...
0
votes
2answers
23 views

Many nullable objects, how to set property at the end of path

Let's assume we have to set property on object "ObjectD". To get this object we have to go through path of nullable objects:objectA.objectB?.objectC?.objectD?.property = 1234The problem is that, ...
1
vote
3answers
31 views

Kotlin map function returns a Stream and is not a Java equivalent for collect()

map returns a Stream instead a List<Media>. So the assignment product.media = cleanedMedia will not work. I have to use collect here to make it work. But I often saw people saying that map is ...
0
votes
2answers
26 views

java.lang.NumberFormatException: For input string: “16000$” in kotlin

I want to make display show "16000$" before click increase btn or decrease btn.when I make code like this error caused by :java.lang.NumberFormatException: For input string: "16000$ . but I should ...
0
votes
1answer
33 views

Kotlin: Idiomatic & Declarative way to find count of a loop without mutation

How to count no.of times a loop has run with a condition, for example:var count = 0while (stk.isNotEmpty()) { stack.pop() count++}But this involves a temporary counter and mutation. Is there ...
0
votes
1answer
11 views

pdf is not scaling in pdfview android

I am using library Dmitry-Borodin/pdfview-android for showing pdf in android. My view is showing pdf correctly but the scaling of pdf doesnot seems to be working.pdfView!!.fromFile(file!!).scale(...

15 30 50 per page