https://kotlinlang.org
Join Slack
How to show the software keyboard on composition (i.e. when a screen composable is first displayed)?
j

julioromano

over 4 years ago
How to show the software keyboard on composition (i.e. when a screen composable is first displayed)?
j
f
+3
  • 5
  • 26
  • 698
If I handle config changes manually (no activity recreation) and I want to override the system langu...
j

Jordi Saumell

almost 5 years ago
If I handle config changes manually (no activity recreation) and I want to override the system language the only way I’ve found is by using
updateConfiguration(config, displayMetrics)
, which works fine but happens to be deprecated 😅. All other ways that I know of rely on activity recreation (wrapping the context and using
createConfigurationContext
, using
attachBaseContext
, using
applyOverrideConfiguration
). Is there a non-deprecated way of doing this (without recreating the activity)? (I think overwriting the language is considered not being the best practice, but it is quite common and many clients want it 🤷‍♂️)
j
a
  • 2
  • 18
  • 698
Hello! How to get current coroutine dispatcher?
p

PHondogo

about 2 years ago
Hello! How to get current coroutine dispatcher?
p
s
+3
  • 5
  • 6
  • 697
Can anyone help? I am stuck with a `Ktor` `Websocket` issue where the connection is non-responsive a...
g

george.m

over 1 year ago
Can anyone help? I am stuck with a
Ktor
Websocket
issue where the connection is non-responsive after receieving a push notification message from the server. The same code using
okhttp3.OkHttpClient
is fine. Details in the 🧵 below 👇:
g
a
e
  • 3
  • 38
  • 696
Hi How to make Dialog scrollable in jetpack compose desktop because this not woking <https://stackov...
d

dhia chemingui

about 2 years ago
Hi How to make Dialog scrollable in jetpack compose desktop because this not woking https://stackoverflow.com/questions/69683622/jetpack-compose-scrolling-in-dialog-gives-strange-effects
d
a
  • 2
  • 5
  • 696
I’m getting bunch of weird looking crashes when I use `ComposeView` within my application. I’ve dug ...
j

Jakub Wiśniewski

about 3 years ago
I’m getting bunch of weird looking crashes when I use
ComposeView
within my application. I’ve dug trough all the sources and still cannot find the cause od the problem. TLDR version of it is that I have a list with error view on top of it that contains “refresh” button. Clicking it with my internet off (so that the view will appear) makes my app crash with bunch of compose related logs that do not point in any direction such as:
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3 -> ViewGroup
java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.node.MeasureAndLayoutDelegate
java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.platform.AndroidComposeView.notifyLayerIsDirty
java.lang.IllegalStateException: Underflow in restore - more restores than saves

Exception Type: Unknown (SIGSEGV)
What is important to mention is that it only happens on RELEASE version of the App. I’ve dissected my app and trying to reproduce the issue on fresh repo but I wasn’t able to, yet. No such problems when I switch to
ComponentActivity
instead of
Fragment
with
ComposeView
as its only view. I don’t have unusual amount of recompositions either - around 2 for state. Would appreciate any kind of help, guidance, ideas what might be the source of my problem.
j
z
+2
  • 4
  • 39
  • 696
How do I deactivate rules? I get a lot of false positives and therefore want to exlude some rules. I...
h

Henning B

about 4 years ago
How do I deactivate rules? I get a lot of false positives and therefore want to exlude some rules. I created a file named
.editorconfig
in the top level of my project with the contents
# Don't autoformat this file, IntelliJ adds forbidden spaces
root=true

[*.{kt,kts}]
disabled_rules=indent,max-line-length
insert_final_newline=true
But indent and max line length is still checked.
h
t
  • 2
  • 4
  • 696
I am trying to use pixelcopy to capture the screen in a compose application, however, it asks for a ...
g

Guy Bieber

over 5 years ago
I am trying to use pixelcopy to capture the screen in a compose application, however, it asks for a view (which is kind of hidden in compose). What is the relationship between compose and views? How do I get the view currently being rendered by compose?
fun getScreenShotFromView(view: View, activity: Activity, callback: (Bitmap) -> Unit) {
    activity.window?.let { window ->
        val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888)
        val locationOfViewInWindow = IntArray(2)
        view.getLocationInWindow(locationOfViewInWindow)
        try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                PixelCopy.request(
                    window,
                    Rect(
                        locationOfViewInWindow[0],
                        locationOfViewInWindow[1],
                        locationOfViewInWindow[0] + view.width,
                        locationOfViewInWindow[1] + view.height
                    ), bitmap, { copyResult ->
                        if (copyResult == PixelCopy.SUCCESS) {
                            callback(bitmap) }
                        else {

                        }
                        // possible to handle other result codes ...
                    },
                    Handler()
                )
            }
        } catch (e: IllegalArgumentException) {
            // PixelCopy may throw IllegalArgumentException, make sure to handle it
            e.printStackTrace()
        }
    }
}
g
l
+5
  • 7
  • 17
  • 693
Hi there! I am running into a Jackson issue with sealed classes. I have the following code: ```@Js...
a

Arnab

over 3 years ago
Hi there! I am running into a Jackson issue with sealed classes. I have the following code:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
sealed class Principal
object AnonymousUser : Principal() {
  val _empty: String? = null
}

// other implementations of Principal

fun main() {
  // jacksonObjectMapper() is a function in jackson which creates an object mapper with the Kotlin module
  val input = jacksonObjectMapper().writeValueAsString(AnonymousUser)
  val principal = jacksonObjectMapper().readValue(input, Principal::class.java)
  println(principal)
}
This gives me the following error:
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "_empty" (class com.example.hellojavabin.graphql.context.Principal$AnonymousUser), not marked as ignorable (0 known properties: ])
 at [Source: (String)"{"@type":"Principal$AnonymousUser","_empty":null}"; line: 1, column: 49] (through reference chain: com.example.hellojavabin.graphql.context.Principal$AnonymousUser["_empty"])
What am I missing here? I also tried casting the input string directly to
AnonymousUser
but that fails with the same issue. Has anyone done something similar?
a
  • 1
  • 1
  • 691
Hello, how do you debug multiplatform part of iOS projects? The official way to do that is using KMM...
a

antrax

almost 2 years ago
Hello, how do you debug multiplatform part of iOS projects? The official way to do that is using KMM plugin. However it has serious problem described here https://youtrack.jetbrains.com/issue/KT-56219/KMM-plugin-provide-an-arch-option-in-the-iOS-run-configuration.
a
f
  • 2
  • 4
  • 690
Previous838485Next

kotlinlang

A modern programming language that makes developers happier.

Powered by