https://kotlinlang.org
Join Slack
Hi, what's the sense of concatenating wrapContentSize to fillMaxSize in a Modifier? I mean this: ```...
p

Pablo

almost 2 years ago
Hi, what's the sense of concatenating wrapContentSize to fillMaxSize in a Modifier? I mean this:
Modifier
    .fillMaxSize()
    .wrapContentSize()
They do it in a compose sample of a Android development guide from official android guides. ( https://developer.android.com/codelabs/basic-android-kotlin-compose-build-a-dice-roller[…]abs%2Fbasic-android-kotlin-compose-build-a-dice-roller-app ) I mean... fillMaxSize does that the view fills the entire screen, and wrapContentSize does that the view uses only it's size.. so I don't understand why use both at same time. They do it to center the view, passing an argument to wrapContentSize, but I just can't understand this way of achieving it. I mean.. if you wanna center a view, you supposedly put that view in a bigger container and center it, but passing a "fillMaxSize" and a "wrapContentSize" to center it is very strange.
p
c
+2
  • 4
  • 25
  • 430
Can I use value classes in shared code from Swift? I defined in my shared code this: ```@JvmInline ...
s

Stefan Oltmann

almost 4 years ago
Can I use value classes in shared code from Swift? I defined in my shared code this:
@JvmInline
value class PhotoUri(val value: String)
In Swift
PhotoUri
is not defined according to the error message. Attributes that use it seem to be of type
Any
now. If I change that to an data class it's available. How can I use value classes with Kotlin v1.6.10?
✅ 1
s
h
p
  • 3
  • 34
  • 430
Hello, some of my users are getting this crash in my app: ``` Fatal Exception: kotlinx.coroutines.fl...
t

Thomas

over 6 years ago
Hello, some of my users are getting this crash in my app:
Fatal Exception: kotlinx.coroutines.flow.internal.ChildCancelledException Child of the scoped flow was cancelled
For some reason this crash does not have a stack trace (on both Firebase and Google Play). This makes it very hard to find the cause. Could someone here help me out? I am using Kotlin
1.3.41
and Coroutines
1.3.0-M2
.
t
d
+2
  • 4
  • 10
  • 430
Is it possible, and if so how, do I use the new K2 compiler with kotlin 1.8.20 when using Maven?
e

Erik Dreyer

over 2 years ago
Is it possible, and if so how, do I use the new K2 compiler with kotlin 1.8.20 when using Maven?
e
e
  • 2
  • 4
  • 429
Hi I have a delete request that works fine, but when I make subsequent delete calls to an item that ...
s

Sky

about 3 years ago
Hi I have a delete request that works fine, but when I make subsequent delete calls to an item that has already been deleted in the API, I get an Exception, and the app crashes. I tried handling the error using Try/Catch with different exceptions eg(HttpException, IOException, etc) to prevent the app from crashing but it doesn't seem to work.
private fun deleteFavourite(
    favourite: GetFavourite?,
    viewModel: WallpapersSharedViewModel
) {
    //handling 404 error in case of subsequent Delete request
    try {
        if (favourite != null && !favourite.isEmpty()) {
            val favouriteId = favourite.get(0).id
            viewModel.deleteFavourite(favouriteId)
            Log.i("hiiiiyaa", "deleted${favouriteId}")
        }
    }
    catch (e: HttpException){
        Log.i("hiiiiyaa", "cannot find item to delete in the Api")
    }
}
Error:
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.catexplorer, PID: 28492
    retrofit2.HttpException: HTTP 400 
        at retrofit2.KotlinExtensions$await$2$2.onResponse(KotlinExtensions.kt:53)
        at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:161)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
      ............
🧵 1
s
p
  • 2
  • 15
  • 429
I've switched out Netty for CIO as the Ktor server to see if the performance would be better, but it...
j

janvladimirmostert

about 6 years ago
I've switched out Netty for CIO as the Ktor server to see if the performance would be better, but it seems much worse. Is CIO supposed to outperform Netty now or at some point or can it be tweaked to do that? On Netty, my throughput is about 38,000 requests per minute with 2.5 seconds per request. On CIO it's only about 21,000 and each request takes almost 5 seconds
j
j
a
  • 3
  • 12
  • 429
JUnit 5 `Assertions.assertThrows` doesn't work if the block calls a suspend function, because the (J...
d

David Glasser

over 6 years ago
JUnit 5
Assertions.assertThrows
doesn't work if the block calls a suspend function, because the (Java) function isn't
inline
. What do people do here? Write their own version?
d
o
  • 2
  • 4
  • 429
In Android, we normally store a static JSON files in the `raw` directory, and then it can be accesse...
a

Avadhut

almost 2 years ago
In Android, we normally store a static JSON files in the
raw
directory, and then it can be accessed as a normal file. What's the equivalent approach for handling such static files in shared KMP code? Thanks!
a
r
m
  • 3
  • 12
  • 428
In KMM project, can i add a dependency on xcframework library to iOS target?
v

Vladimir Vainer

over 2 years ago
In KMM project, can i add a dependency on xcframework library to iOS target?
v
j
  • 2
  • 3
  • 428
Anyone else seeing this after updating to compose 1.7? ```java.lang.IllegalStateException: Dispatchi...
m

Mark

about 1 year ago
Anyone else seeing this after updating to compose 1.7?
java.lang.IllegalStateException: Dispatching intercepted soft keyboard event while focus system is invalidated.
       at androidx.compose.ui.focus.FocusOwnerImpl.dispatchInterceptedSoftKeyboardEvent-ZmokQxo(FocusOwnerImpl.java:282)
       at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEventPreIme(AndroidComposeView.android.kt:965)
       at android.view.ViewGroup.dispatchKeyEventPreIme(ViewGroup.java:1970)
m
l
  • 2
  • 2
  • 427
Previous156157158Next

kotlinlang

A modern programming language that makes developers happier.

Powered by