https://kotlinlang.org logo
Join SlackCommunities
Powered by
# androidx
  • r

    Roar Gronmo

    08/18/2020, 5:45 PM
    set the channel description: Discussing androidx using kotlin
  • r

    Roar Gronmo

    08/28/2020, 10:00 AM
    androidx.constraintlayoutconstraintlayout2.0.1 and 2.0.0 does not work in the same way as 2.0.0-rc1 and before regarding handling of constraints relating to views which are in the state of "gone". When a view is gone (also become a "singularity", it has shrunk to a infinite point, but should still be possible to relate to). If this is a "breaking" change or an error, I have not received any feedback on. Will try to make a proof of concept to check this out in near future. Could be checked here: https://issuetracker.google.com/issues/166486001
    • 1
    • 1
  • r

    Roar Gronmo

    08/28/2020, 10:31 AM
    androidx.camera.camera-camera2:1.0.0-beta08, -lifecycle:1.0.0-beta08, -view:1.0.0-alpha15, may crash on API30 (Android 11) on emulator (ie Pixel3a with latest API30 image). It works OK in API29. The error is bound to ImageCapture.OnImageSavedCallback Issuetracker: https://issuetracker.google.com/issues/166658118 and could be further tested on codelabs CameraX tutorial: https://codelabs.developers.google.com/codelabs/camerax-getting-started/index.html?index=..%2F..index#0
  • m

    Marek Kubiczek

    10/21/2020, 8:23 AM
    Anyone here have some experience with AndroidX Paging3? Is there a way to get the list of items from
    PagingData
    ? Seems like it only supports
    map
    ,
    flatMap
    and
    filter
    .
    r
    • 2
    • 1
  • v

    Vivekpanchal64

    11/21/2020, 11:48 AM
    can anyone explain me how do i define default animations for navigation for navigation components..!! instead of keep defining animation for each nav action ??
    stackoverflow 1
  • n

    note8g2018

    03/03/2021, 10:10 AM
    Please tell Google to update the code lab for jetpack compose https://developer.android.com/courses/pathways/compose It is not working now Because the code is old and there are many huge changes in the framework jetpack compose Google should update the code
  • r

    Remon Shehata

    03/21/2021, 7:47 PM
    I am using
    ProcessLifecycleOwner
    and I am adding observer like this
    Copy code
    LifecycleRegistry.createUnsafe(ProcessLifecycleOwner.get()).addObserver(onProcessLifeCycleResume)
    and here is my observer
    Copy code
    class OnProcessLifeCycleResume(private val doInOnResume: () -> Unit) : LifecycleObserver {
        private val TAG = "LifeCycleDemo"
    
        @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
        fun onMoveToForeground() {
            val handler = Handler(Looper.getMainLooper())
    
            Log.d(TAG, "onMoveToForeground: ")
            doInOnResume()
    
        }
    }
    but it's never triggered. any idea why?
  • t

    Tanvi Goyal

    05/06/2021, 2:08 PM
    I am using Work Manager in my project for the first time. I am facing a weird crash which says -
    Copy code
    Unable to get provider androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: Didn't find class "androidx.work.impl.WorkManagerInitializer" on path: DexPathList
    After researching a bit, I found this maybe due to the obfuscation done by proguard on the classNames used to instantiate the Worker classes. Tried to fix this by adding this in the proguard but with no luck.
    Copy code
    -keep class androidx.work.** { *; }
    Any idea what I am missing here ?
    😶 1
  • t

    Tim Malseed

    08/03/2021, 2:48 PM
    I've got this really strange problem where it seems like my InstumentedTests are being run with the Robolectric framework, despite the fact that I'm not (deliberately) using Robolectric. I'm posting here because I am using the
    androidx.test.core
    APIs, and I suspect that's something to do with it. When I try to run an instrumented test, I get something like:
    AndroidJUnitRunner cannot be cast to org.robolectric.android.fakes.RoboMonitoringInstrumentation
    • 1
    • 7
  • j

    Jishin Dev [JD]

    12/23/2021, 7:35 AM
    Any idea why this crash would happen in a flutter app which uses an android sdk(java) that uses an android sdk(kotlin) that uses
    androidx.datastore:datastore-preferences:1.0.0
    ?
    Copy code
    Fatal Exception: java.lang.IllegalAccessError: Illegal class access: 'c.l.a.p' attempting to access 'kotlinx.coroutines.u' (declaration of 'c.l.a.p' appears in base.apk)
           at androidx.datastore.core.SingleProcessDataStore.a(SingleProcessDataStore.java:28)
           at androidx.datastore.preferences.core.PreferenceDataStore.updateData(PreferenceDataStore.java:8)
           at androidx.datastore.preferences.core.PreferencesKt.edit(PreferencesKt.java:6)
           at com.example.crashguard.data.repo.PrefsRepo$set$1.invokeSuspend(PrefsRepo.java:2)
           at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:2)
           at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:86)
           at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoopImplBase.java:4)
           at kotlinx.coroutines.BlockingCoroutine.joinBlocking(BlockingCoroutine.java:2)
           at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(BuildersKt__BuildersKt.java:6)
           at kotlinx.coroutines.BuildersKt.runBlocking(BuildersKt.java:6)
           at kotlinx.coroutines.BuildersKt.runBlocking$default(BuildersKt.java:6)
  • m

    Mahdi

    01/17/2022, 7:49 AM
    #paging #datasource Hi guys I have some problem with Paging 3 Documents says that if data's order is changed I have to create new Paging source. A [PagingSource] / [PagingData] pair is a snapshot of the data set. A new [PagingData] / * [PagingData] must be created if an update occurs, such as a reorder, insert, delete, or content * update occurs. A [PagingSource] must detect that it cannot continue loading its snapshot * (for instance, when Database query notices a table being invalidated), and call [invalidate]. * Then a new [PagingSource] / [PagingData] pair would be created to represent data from the new * state of the database query. By creating a new source, adapter data is not clearing well and new items will add to end of last items, then I have to also re create adapter and assyn to recycle view and lots of other headaches. If I go to use invalidate () inside data source, recycler parts works well but I can not bring user back to last point! In my case my data source get data from net and in some page may previous data is not validate any more( for example items order is changed) and I wanna get data from start, but bring user back to last point! Problem here is if I invalidate() in data source it will start from begining and there is no way to make recycler view scroll to last visible point cause data is not loaded yet!
  • n

    Noushad Chullian

    02/20/2022, 9:10 AM
    Hi, friends, I need help to make my app available for large screens. I am using jetpack navigation with fragments. can anyone help me?
  • d

    Dragos Rachieru

    04/04/2022, 12:06 PM
    Hello, I was thinking about rewritting the
    ViewModel
    logic in kotlin to make it multiplatform. I was thinking about making the
    ViewModel
    available for multiplatform applications(like compose for desktop) so I can reuse more code for my app. My use case is a multiplatform navigation for
    Compose for Desktop
    that will work on android and desktop(js and ios in the future). I need to create the
    ViewModelStoreOwner
    to be part of the navigation library
    j
    • 2
    • 2
  • j

    James Black

    04/14/2022, 3:17 AM
    I am trying to add biometric authentication to my Compose app, but the instructions here are dated, as they use 'startActivityForResult' which is deprecated. It seems I will need to add a lot of code to my MainActivity before I call my first compose UI element. For this project I only need to go down to display the login prompt. For another I needed to do more, including encrypting a secret key but I abandoned that as it got too messy, and I didn't want to go back to using Fragments. Is there updated documentation somewhere? https://developer.android.com/training/sign-in/biometric-auth
  • n

    Noushad Chullian

    04/16/2022, 10:20 AM
    Hi.. I have a list of videos, which are attached to recyclerviews using paging3. i am stuck at somewhere, where i selected a video from the perveios fragment, no i have to show the specific video at the current visible position of recyclerview, how can i acheive that #Question
    😶 1
  • a

    AG

    05/26/2022, 4:59 PM
    I'm adding benchmark gradle plugin in top level gradle
    Copy code
    plugins {
        id 'androidx.benchmark' version '1.0.0' apply false
       
    }
    but getting this error
    Untitled.txt
    e
    • 2
    • 2
  • k

    kotlinforandroid

    06/11/2022, 4:23 PM
    I use a
    CoroutineWorker
    do download some items. I use
    setForeground
    to initiate a foreground notification. However, when updating the notification to display the progress, the notification icon moves around in the status bar. Does anyone know why this happens? I use
    setForeground
    to update the notification.
    😶 1
  • g

    gts13

    01/11/2023, 6:03 PM
    Can multiple datastores cause any troubles in an app? I mean having two separate
    preferencesDataStore
    with two different names?
    b
    • 2
    • 1
  • f

    Filip Wiesner

    04/17/2023, 2:54 PM
    Hi 👋 Is there some way I could "await" when new PagingSource is finished loading after invalidation? My use case is that I want to log something in viewModel when source is finished loading after being invalidated and I can't find a way to do this. The obvious way of doing this is check the actual UI where I collect this but I would like to do this separately from UI (in ViewModel)
    l
    • 2
    • 2
  • y

    Yashwant Gowla

    07/04/2023, 8:34 AM
    Has anyone added an image to the splash screen? I want to add an image to the splash screen and I have tried 'android:windowBackground' in the splash screen style. It's working fine on some devices, but most of them show a solid colour. Does anyone have any idea about this?
  • i

    Iman Sadrian

    07/31/2023, 2:04 PM
    Hi folks! I've been facing some challenges with
    Media3
    recently, and I could really use some help. To give you a brief overview, I migrated our app from ExoPlayer to Media3 and followed Google's migration guide. However, it appears that there's no straightforward way to handle MediaButton KeyEvent actions manually. I've been trying to find a solution, but so far, I haven't been successful. I tried to elaborate my question here I'd greatly appreciate any insights or suggestions you may have on how to handle MediaButton actions manually with Media3. Thank you in advance for your help! #media3 #exo
  • j

    jordond

    08/01/2023, 7:51 PM
    Anyone know if its possible to add looping music to a video file using media3 Transformer? Lets say I have a 60 second video that contains audio. And a 15 second audio clip. I would like to loop that audio clip all the way to the end of the video overtop of the video’s audio. I’ve looked at a couple different libraries (transcoder, Litr), none of them offer this ability. I’ve tried writing something myself but I’m really struggling with the MediaCodec aspect of all this.
  • o

    Oluwafemi Ogundipe

    09/27/2023, 10:20 AM
    I’m having issue with with Media3 expo player I user it to
    Copy code
    fun VideoPreviewScreen(
        uri: String,
    ) {
    
       val exoPlayer = remember(context) {
            ExoPlayer.Builder(context).build().apply {
                setMediaItem(MediaItem.fromUri(uri))
                prepare()
            }
        }
    
    Box{
     AndroidView(
                            factory = { context ->
                                PlayerView(context).apply {
                                    player = exoPlayer
                                    exoPlayer.play()
                                    exoPlayer.addListener(object : Player.Listener {
                                        override fun onPlaybackStateChanged(state: Int) {
                                            super.onPlaybackStateChanged(state)
                                            when (state) {
                                                Player.STATE_READY -> {
                                                    if (shouldSetOnReady) {
                                                        startTime.value = 0f
                                                        endTime.value =
                                                            exoPlayer.contentDuration.toFloat()
                                                        shouldSetOnReady = false
                                                    }
                                                }
    
                                                Player.STATE_BUFFERING -> {
                                                 
                                                }
    
                                                Player.STATE_ENDED -> {
                                         
                                                }
    
                                                Player.STATE_IDLE -> {
                                                    
                                                }
    
                                                else -> {
                             
                                                }
                                            }
                                        }
                                    })
                                    exoPlayer.prepare()
                                    exoPlayer.play()
                                }
                            },
                            update = {
    
                            },
                        )
    }
    
    }
    But the app crashes sometimes with this error
    Copy code
    FATAL EXCEPTION: main
                                                                                                        Process: com.playcenter.callerview, PID: 11962
                                                                                                        LiveEdit: Could not invoke method 'onEvents(Landroidx/media3/common/Player;Landroidx/media3/common/Player$Events;)V'
                                                                                                        java.lang.NullPointerException: null receiver
                                                                                                        	at com.android.tools.deploy.liveedit.ProxyClassHandler.invokeMethod(ProxyClassHandler.java:101)
                                                                                                        	at com.android.tools.deploy.liveedit.ProxyClassHandler.invoke(ProxyClassHandler.java:126)
                                                                                                        	at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
                                                                                                        	at $Proxy7.onEvents(Unknown Source)
                                                                                                        	at androidx.media3.exoplayer.ExoPlayerImpl.lambda$new$0$androidx-media3-exoplayer-ExoPlayerImpl(ExoPlayerImpl.java:281)
                                                                                                        	at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda12.invoke(Unknown Source:4)
                                                                                                        	at androidx.media3.common.util.ListenerSet$ListenerHolder.iterationFinished(ListenerSet.java:350)
                                                                                                        	at androidx.media3.common.util.ListenerSet.handleMessage(ListenerSet.java:294)
                                                                                                        	at androidx.media3.common.util.ListenerSet.$r8$lambda$bio3pd12v5B_9b5UeFaPn9XBQ90(Unknown Source:0)
                                                                                                        	at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda0.handleMessage(Unknown Source:2)
                                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                        	at android.os.Looper.loop(Looper.java:268)
                                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:8046)
                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
                                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1115)
                                                                                                        Caused by: java.lang.NullPointerException: null receiver
                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        	at com.android.tools.deploy.liveedit.ProxyClassHandler.invokeMethod(ProxyClassHandler.java:99)
                                                                                                        	at com.android.tools.deploy.liveedit.ProxyClassHandler.invoke(ProxyClassHandler.java:126)
                                                                                                        	at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
                                                                                                        	at $Proxy7.onEvents(Unknown Source)
                                                                                                        	at androidx.media3.exoplayer.ExoPlayerImpl.lambda$new$0$androidx-media3-exoplayer-ExoPlayerImpl(ExoPlayerImpl.java:281)
                                                                                                        	at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda12.invoke(Unknown Source:4)
                                                                                                        	at androidx.media3.common.util.ListenerSet$ListenerHolder.iterationFinished(ListenerSet.java:350)
                                                                                                        	at androidx.media3.common.util.ListenerSet.handleMessage(ListenerSet.java:294)
                                                                                                        	at androidx.media3.common.util.ListenerSet.$r8$lambda$bio3pd12v5B_9b5UeFaPn9XBQ90(Unknown Source:0)
                                                                                                        	at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda0.handleMessage(Unknown Source:2)
                                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                        	at android.os.Looper.loop(Looper.java:268)
                                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:8046)
                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
                                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1115)
    j
    • 2
    • 2
  • a

    Aniket Kadam

    01/31/2024, 8:23 AM
    I'm having a strange issue with possibly media3 or maybe it's something else. Whenever I open the fragment that contains my PlayerView, the volume controls open. What causes the UI for the volume to open up at all? got it, it was setting the mute status initially which opens the device volume manager.
  • a

    Abhishek Sharma

    11/13/2024, 3:05 PM
    Hey, has anyone worked with Auto zoom via Camera X, I have trying to implement it for Scanner made using Image Analyser, but didn't found any good references for Auto zoom. Any suggestions?