https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • m

    Marcin Środa

    09/08/2020, 12:49 PM
    How to deal with lifecycle in Composable? I’ve based on
    onActive
    /
    onCommit
    /
    onDispose
    , but what about something similar to
    onPause
    /
    onResume
    ? I’m looking for something that will tell me that the activity has gone background / foreground.
    f
    1 reply · 2 participants
  • j

    JulianK

    09/08/2020, 12:55 PM
    Is there a way to remember scroll state in LazyColumnFor? In ScrollableColumn, i can just pull out scrollState, LazyFor does not provide this parameter. When i try to use Modifier.verticalScroll() on LazyColumnFor using a saved scroll state, scroll behaviour is messed up (no acceleration when 'flinging' the page). Anybody uses LazyColumnFor with a saved scroll state?
    m
    y
    +1
    9 replies · 4 participants
  • n

    Namig Tahmazli

    09/08/2020, 3:01 PM
    Hi. When I read documentation of each class or function, some samples are indicated there but I do not know how I can have a look at it. For Instance.
    * [key] is a utility composable that is used to "group" or "key" a block of execution inside of a
     * composition. This is sometimes needed for correctness inside of control-flow that may cause a
     * given composable invocation to execute more than once during composition.
     *
     * The value for a key *does not need to be globally unique*, and needs only be unique amongst the
     * invocations of [key] *at that point* in composition.
     *
     * For instance, consider the following example:
     *
     * @sample androidx.compose.runtime.samples.locallyUniqueKeys
    Here I do not know how I can check
    locallyUniqueKeys
    to understand the given sample better. Do you know where I can find them?
    ➕ 1
    a
    n
    4 replies · 3 participants
  • j

    Julius Marozas

    09/08/2020, 8:14 PM
    As I understand when some composable "X" uses
    value
    on some
    State<T>
    "S", then the Compose runtime automatically recomposes X when S changes. Potentially bypassing recomposing any composables that just forward S to X without calling
    value
    . In my app, I have a "container composables" that are responsible for observing streams from a view model and passing the observed values to children composables. In one of the containers I have
    StateFlow<List<T>>.collectAsState()
    and I pass
    State<List<T>>
    to children of the container. What should I do, if I want to pass a boolean indicating whether
    List<T>
    is empty? Can I somehow create a new
    State<Boolean>
    ? And in general, should I always prefer to pass
    State<T>
    to composables instead of just
    T
    ?
    j
    4 replies · 2 participants
  • s

    Sergey Y.

    09/08/2020, 9:03 PM
    Hi. Is there any modifier that could work as decoration to the composable views? I want to recreate the SwiftUI's redacted placeholder API. Ideally, I need some modifier that could return me the boundaries of an underlying view hierarchy(only top-level) and be able to draw some geometrical figures ontop. Or what way should I look to create this modifier my own? Thanks.
    j
    z
    +1
    10 replies · 4 participants
  • j

    JD

    09/09/2020, 2:52 AM
    While trying the the Kotlin State Codelab i have noticed the TextField component never seems to be able to delete the first character in the field. This happens only on the first launch when the app is launched the back arrow seems to leave the first character. Has anyone else faced this issue? Video representation below
    TextDeletion.webm
    s
    4 replies · 2 participants
  • j

    JD

    09/09/2020, 3:43 AM
    I am facing issue with the imeAction in the State Kotlin CodeLab. When done is pressed at that time the value of text is always returned empty. Also, when viewed in the imeAction the value of text comes back as empty. Source code:
    onImeActionPerformed = { action, softKeyboardController ->
        if (action == ImeAction.Done) {
            onImeAction()
            softKeyboardController?.hideSoftwareKeyboard()
        }
    },
    Handling on the submit callback:
    val submit = {
        onItemComplete(TodoItem(text))
        setIcon(TodoIcon.Default)
        setText("")
    }
    Video:
    imeAction.webm
    s
    1 reply · 2 participants
  • m

    Mehmet Peker

    09/09/2020, 7:14 AM
    Hello everyone, im trying add jetpack compose to my an existing app but i cant. I have an error related of room compiler(annotation processors).When compose is enabled annotation processor get error.Can anyone help me?
    g
    12 replies · 2 participants
  • m

    MBegemot

    09/09/2020, 9:21 AM
    Hi composers. Today I simple changed a Checkbox into a Switch and now the switch oscillates between it's two states on his own. As the parameters are equal for both widgets, I guess it should be a bug.
    y
    1 reply · 2 participants
  • m

    MBegemot

    09/09/2020, 9:34 AM
    Honestly there is no much to share simply change Checkbox keyword for Switch....
    Row(Modifier.padding(5.dp)) {
        Text("Selected")
        //Switch(checked = lselected, onCheckedChange = { lselected = !lselected} )
        Checkbox(checked = lselected, onCheckedChange = { lselected = !lselected} )
        Text("Unselected")
    }
    y
    m
    7 replies · 3 participants
  • m

    MBegemot

    09/09/2020, 9:45 AM
    var lselected by mutableStateOf(true)
    But again if it's a checkbox it's fine ...You can see the issue by clicking on settings languages +languages
    y
    t
    13 replies · 3 participants
  • v

    vipulasri

    09/09/2020, 11:19 AM
    Whats the alternative to
    BounceInterpolator
    in jetpack compose?
    a
    2 replies · 2 participants
  • y

    Yann Badoual

    09/09/2020, 3:07 PM
    Is there a sample or some doc about playing transitions sequentially?
    var animationIndex by remember { mutableStateOf(0) }
    val definition = remember(animationIndex) { buildTransition(animationIndex = animationIndex) }
    val state = transition(
        definition = definition,
        initState = AnimationState.START,
        toState = AnimationState.END,
        onStateChangeFinished = {
            if (animationIndex < animationCount) {
                animationIndex++
            }
        }
    )
    This works, but feels weird, and has some drawbacks: • Doesn't work well with @Preview animation inspector •
    animationIndex
    can't be used in the code depending on the animation, because when one animation is completed, there's a brief moment where
    animationIndex
    was incremented but
    state
    is still on the
    AnimationState.END
    because the next one didn't start. So I have to add the index as a key inside the state to fix this. It works fine, but error prone
    d
    9 replies · 2 participants
  • a

    Ash

    09/09/2020, 3:30 PM
    The same way SwiftUI came from watchOS, I hope I can use my Composable in WearOS? Having a hard time finding info about it ... Tutorial? I am guessing it should just work ???
    i
    1 reply · 2 participants
  • r

    Robert Menke

    09/09/2020, 4:05 PM
    Apologize if this has been asked a million times. Is it common to use dependency injection with something like Hilt with Compose? In @Leland Richardson [G]’s example in “Thinking in Compose” it looks like compose already has a helper function called
    viewModel
    that will provide a properly scoped view model. This looks great, but my concern is that for testing purposes if I want to create a fake for a service that makes a network call and then inject it into my view model I still need something like Hilt. Is there a recommended best practice or tutorial for dependency injection with compose?
    r
    s
    +2
    18 replies · 5 participants
  • n

    Nick

    09/09/2020, 5:10 PM
    Hi people, I'm hoping to use Google Sign-in in a compose app by using the
    AndroidView
    Composable, but I can't seem to get it working. Has anyone else had luck embedding an old-style view on the
    alpha-02
    build? It doesn't necessarily need to be Google Sign-in, it could be any other view. I've watched the alpha video where they embed the Google Maps view but that did not help me!
    z
    6 replies · 2 participants
  • a

    Arkadii Ivanov

    09/09/2020, 5:17 PM
    Hello. I'm trying to use Compose in a multiplatform module. For some reason I'm not able to call any
    @Composable inline
    function from another
    @Composable
    function. E.g. I can't call
    Column {}
    . There is a compilation error.
    3 replies · 1 participant
  • a

    Ali Zargar Shabestari

    09/09/2020, 5:47 PM
    is there any wrapper for fragment to use in compose? my goal is to use a
    PreferenceFragmentCompat
    without rewriting the logic it provides for free.
    m
    3 replies · 2 participants
  • j

    Jan Skrasek

    09/09/2020, 6:56 PM
    How to make TextField only one-line input? (to not autogrow) Can't figure it out.
    c
    1 reply · 2 participants
  • c

    Colton Idle

    09/09/2020, 7:10 PM
    I haven't tried using compose for this, but early today I was tasked with implementing a Modal (dialog, alertDialog, fragmentDialog?) in regular android UI toolkit land and it just got me thinking... I really hate writing modals/dialogs currently in Android. The width of the modal is always an issue I have to work around, there's like 3+ dialogs to use/inherit from and I always forget what's the right one, and there's weird gotchas where you have to remember to override one method, but not another method. Maybe it's just me? What is compose doing to make modals easy in Android?
    i
    5 replies · 2 participants
  • d

    Daniele B

    09/09/2020, 7:19 PM
    I am publishing several Text elements inside a composable, which fill more than one screen. I need what in the standard Android view system is called
    ScrollView
    . How do you do that in Compose?
    y
    2 replies · 2 participants
  • m

    Mohamed Elfiky

    09/09/2020, 8:19 PM
    What is subcomposition is it nesting composables?
    z
    11 replies · 2 participants
  • j

    Joaquim

    09/09/2020, 8:31 PM
    Is there a way to have a
    LazyColumn
    start at a given position / offset to maintain scroll position across compositions? (like when navigating back to a list from a detail view)
    z
    a
    8 replies · 3 participants
  • k

    Konyaco

    09/10/2020, 1:45 AM
    I added a WebView to my app by using AndroidView compose function, it throws
    java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
    when I press any key (including backpress, hardware keyboard keys). Do you have the same problem? How can I fix it? 🤔thanks
    👍 1
    a
    m
    +1
    12 replies · 4 participants
  • b

    Brett Best

    09/10/2020, 3:36 AM
    How would I go about calling a suspend function within a button onClick action?
    a
    z
    4 replies · 3 participants
  • c

    Colton Idle

    09/10/2020, 5:52 AM
    I have a project that uses moshi and I'm trying to enable compose. So far I updated kotlin to 1.4, agp to 4.2.0-alpha10, gradle to 6.6.1, When I do the above, my app runs fine, it's only when I add
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion MyVersions.compose_version //this id defined as val compose_version = "1.0.0-alpha02"
        kotlinCompilerVersion '1.4.0'
    }
    I get an error when my app runs due to moshi/kotlin reflection?
    E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.myapp.free, PID: 8768
        kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Could not compute caller for function: public constructor MyNetworkResponse(myFields...) defined in com.myapp.free.MyNetworkResponse[DeserializedClassConstructorDescriptor@aa293b] (member = null)
            at kotlin.reflect.jvm.internal.KFunctionImpl$caller$2.invoke(KFunctionImpl.kt:89)
            at kotlin.reflect.jvm.internal.KFunctionImpl$caller$2.invoke(KFunctionImpl.kt:36)
            at kotlin.reflect.jvm.internal.ReflectProperties$LazyVal.invoke(ReflectProperties.java:62)
            at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
            at kotlin.reflect.jvm.internal.KFunctionImpl.getCaller(Unknown Source:7)
            at kotlin.reflect.jvm.ReflectJvmMapping.getJavaMethod(ReflectJvmMapping.kt:63)
            at kotlin.reflect.jvm.KCallablesJvm.setAccessible(KCallablesJvm.kt:82)
            at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.create(KotlinJsonAdapter.kt:223)
            at com.squareup.moshi.Moshi.nextAdapter(Moshi.java:172)
    Has anyone come across this? I've looked in issuetracker to no avail.
    b
    e
    7 replies · 3 participants
  • h

    Henning B

    09/10/2020, 7:13 AM
    I am testing out compose a bit. Just wondering if the preview is supposed to take this long to appear? One Hello World Text can take several seconds like 3-4 until it appears.
    👍 2
    d
    s
    +3
    8 replies · 6 participants
  • m

    Mehdi Haghgoo

    09/10/2020, 8:26 AM
    Not sure if this is on-topic. Is Jetpack Compose a registered brand of Google? Are there any specific guidelines for using Jetpack Compose brand (or any other Google brand for that matter not specificed in Brand Guidelines)?
    j
    1 reply · 2 participants
  • a

    Adam Bennett

    09/10/2020, 9:09 AM
    Is anyone else seeing this issue with the MdcTheme?
    java.lang.NoSuchMethodError: No static method MdcTheme(Landroid/content/Context;ZZZZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V in class Lcom/google/android/material/composethemeadapter/MdcTheme; or its super classes (declaration of 'com.google.android.material.composethemeadapter.MdcTheme' appears in /data/app/co.cuvva.design.app-LxFTTKv0lEIaA4yoLB_eJw==/base.apk)
            at co.cuvva.design.app.common.CategoriesActivityKt.DesignAppTheme(CategoriesActivity.kt:59)
            at co.cuvva.design.app.common.CategoriesActivityKt.access$DesignAppTheme(Unknown Source:0)
            at co.cuvva.design.app.common.CategoriesActivity$onCreate$1.invoke(CategoriesActivity.kt:42)
            at co.cuvva.design.app.common.CategoriesActivity$onCreate$1.invoke(Unknown Source:10)
            at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:142)
            at androidx.compose.runtime.internal.ComposableLambda.invoke(Unknown Source:10)
            at androidx.compose.ui.selection.SelectionContainerKt$SelectionContainer$3$1.invoke(SelectionContainer.kt:88)
            at androidx.compose.ui.selection.SelectionContainerKt$SelectionContainer$3$1.invoke(Unknown Source:10)
            at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:142)
            at androidx.compose.runtime.internal.ComposableLambda.invoke(Unknown Source:10)
    s
    n
    7 replies · 3 participants
  • m

    Mehmet Peker

    09/10/2020, 10:11 AM
    hello everyone i finally add compose an existing project but i have a question.How can i do activity.onBackpressed on navigation icon click without use navigation library?
    t
    23 replies · 2 participants
Powered by Linen
Title
m

Mehmet Peker

09/10/2020, 10:11 AM
hello everyone i finally add compose an existing project but i have a question.How can i do activity.onBackpressed on navigation icon click without use navigation library?
t

Timo Drick

09/10/2020, 10:17 AM
So i think the correct way would be to add a callback to your composable. And handle this callback at the point where you do setContent {} in your activty so you have access to the activity.
m

Mehmet Peker

09/10/2020, 10:39 AM
Thank you for your solution 😄 I was created fragment instance in companion object and call function but this way seems better
t

Timo Drick

09/10/2020, 10:45 AM
There is also another way to get the activity but maybe not what you should do:
val activity = ContextAmbient.current as Activity
So for navigation i would prefere the callback. But there are other use cases where you need an activity to use an system api and do not want to integrate it into your main activity
m

Mehmet Peker

09/10/2020, 11:01 AM
Okey i know but how to initialize composable function before setcontent{}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    val binding = FragmentMessageBinding.inflate(LayoutInflater.from(requireContext()), container, false)
    (binding.root as ViewGroup).setContent(Recomposer.current()) {
        MessageScreen(this)
    }
    return binding.root
}

override fun onNavigationClick() {
    requireActivity().onBackPressed()
}
Sorry i must after setContent but how?
t

Timo Drick

09/10/2020, 11:05 AM
You should change your MessageScreen to have a callback ->
MessageScreen(onNavigaionClick: () -> Unit)
Than you can write in the setContent part:
MessageScreen() { onNavigationClick() }
I don't think it is a good idea to pass the fragment directly to the composables.
m

Mehmet Peker

09/10/2020, 11:11 AM
Not working for me.App crashing after click
t

Timo Drick

09/10/2020, 11:11 AM
Can you please post the error back stack
m

Mehmet Peker

09/10/2020, 11:18 AM
A part of error 2020-09-10 14:17:43.752 9866-9866/com.zikirmatik.digitaltasbeeh E/InputEventReceiver: Exception dispatching input event. 2020-09-10 14:17:43.753 9866-9866/com.zikirmatik.digitaltasbeeh E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2020-09-10 14:17:43.755 9866-9866/com.zikirmatik.digitaltasbeeh E/MessageQueue-JNI: java.lang.IllegalStateException: Internal state has not been set. This method should not be called in any place but after calls to onPointerInputSetup and before calls to onPointerInputTearDown or onCancel. Also, onCustomEvent must be called appropriately. See docs for details.
t

Timo Drick

09/10/2020, 11:19 AM
Sorry too less information to really help you. Maybe you could post the code of the MessageScreen?
Or just make a simplified version with just one button and try if it is working.
m

Mehmet Peker

09/10/2020, 11:22 AM
2020-09-10 14:21:11.400 10009-10126/com.zikirmatik.digitaltasbeeh E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1 2020-09-10 14:21:31.526 10009-10009/com.zikirmatik.digitaltasbeeh E/InputEventReceiver: Exception dispatching input event. 2020-09-10 14:21:31.527 10009-10009/com.zikirmatik.digitaltasbeeh E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2020-09-10 14:21:31.531 10009-10009/com.zikirmatik.digitaltasbeeh E/MessageQueue-JNI: java.lang.IllegalStateException: Internal state has not been set. This method should not be called in any place but after calls to onPointerInputSetup and before calls to onPointerInputTearDown or onCancel. Also, onCustomEvent must be called appropriately. See docs for details. at androidx.compose.ui.gesture.scrollorientationlocking.ScrollOrientationLocker.getPointersFor(ScrollOrientationLocker.kt:192) at androidx.compose.ui.gesture.DragSlopExceededGestureFilter.onPointerInput-e3WT7_U(DragSlopExceededGestureFilter.kt:122) at androidx.compose.ui.input.pointer.PointerInputFilter.onPointerEvent-d1fqKvQ(PointerEvent.kt:64) at androidx.compose.ui.input.pointer.Node.dispatchToPointerInputFilter(HitPathTracker.kt:530) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:430) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.NodeParent.dispatchChanges(HitPathTracker.kt:282) at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:131) at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-EhkylT0(PointerInputEventProcessor.kt:71) at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.kt:578) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:440) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1830) at android.app.Activity.dispatchTouchEvent(Activity.java:3400) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:398) at android.view.View.dispatchPointerEvent(View.java:12752) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5106) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4909) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4585) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453) at android.view.ViewRootImpl$AsyncInputStage.apply(Vie 2020-09-10 14:21:31.537 10009-10009/com.zikirmatik.digitaltasbeeh E/AndroidRuntime: FATAL EXCEPTION: main Process: com.zikirmatik.digitaltasbeeh, PID: 10009 java.lang.IllegalStateException: Internal state has not been set. This method should not be called in any place but after calls to onPointerInputSetup and before calls to onPointerInputTearDown or onCancel. Also, onCustomEvent must be called appropriately. See docs for details. at androidx.compose.ui.gesture.scrollorientationlocking.ScrollOrientationLocker.getPointersFor(ScrollOrientationLocker.kt:192) at androidx.compose.ui.gesture.DragSlopExceededGestureFilter.onPointerInput-e3WT7_U(DragSlopExceededGestureFilter.kt:122) at androidx.compose.ui.input.pointer.PointerInputFilter.onPointerEvent-d1fqKvQ(PointerEvent.kt:64) at androidx.compose.ui.input.pointer.Node.dispatchToPointerInputFilter(HitPathTracker.kt:530) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:430) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:426) at androidx.compose.ui.input.pointer.NodeParent.dispatchChanges(HitPathTracker.kt:282) at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:131) at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-EhkylT0(PointerInputEventProcessor.kt:71) at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.kt:578) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3030) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:440) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1830) at android.app.Activity.dispatchTouchEvent(Activity.java:3400) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:398) at android.view.View.dispatchPointerEvent(View.java:12752) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5106) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4909) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4585) 2020-09-10 14:21:31.538 10009-10009/com.zikirmatik.digitaltasbeeh E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4642) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7061) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7022) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7195) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:160) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
t

Timo Drick

09/10/2020, 11:23 AM
Sorry did not have this problem yet. Maybe it is a bug of this mixing legacy and compose views?
I think this is still under heavy development.
m

Mehmet Peker

09/10/2020, 11:30 AM
Thank you for everythink i will fork about this
*work
t

Timo Drick

09/10/2020, 11:31 AM
Can you try:
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
return ComposeView(requireContext()).apply {
            setContent {
                MessageView ...
            }
        }
https://developer.android.com/jetpack/compose/interop
m

Mehmet Peker

09/10/2020, 11:41 AM
Not working 😞
View count: 4