Questions tagged [android-lifecycle]

Questions regarding the events forwarded by the system to components, during their lifetime, in an Android Application. Most components have a specific LifeCycle that is imposed upon them. This tag is not meant to be used alone: use with the [android-activity], [android-service] and [android-broadcastreceiver] tags.

Questions regarding the events forwarded by the system to components, during their lifetime, in an Android Application. Most components have a specific LifeCycle that is imposed upon them. This tag is not meant to be used alone: use with , , , or

Android Activity Lifecycle

Activity and Fragment Lifecycle Diagram

2414 questions
0
votes
0 answers

ViewPager2 fragments lifecycle not working. Viewpager2 inside fragment

I have this structure Tabs with fragments ---(one)Fragment with ViewPager2 ------- Fragments inside ViewPager2 When I change between ViewPager's fragments, onResume and onPause are called just fine. Problem comes when I click on another tab to…
0
votes
0 answers

Jetpack Compose androidx.lifecycle.lifecycleScope - receiver type mismatch

UPDATE: As ianhanniballake pointed out in his comment, I needed to use viewModelScope instead of lifecycleScope. This is now resolved. I am trying to use androidx.lifecycle.lifecycleScope in my Android Native Jetpack Compose app. I have the…
0
votes
0 answers

Run code after closed Flutter app (detached)

I want to run some tasks when I closed application using flutter, This tasks are some functions to delete data from firebase when the app is closing (detached) I used WorkManager and didChangeAppLifecycleState, it is work when state ==…
Oualid
  • 1
  • 2
0
votes
1 answer

When initializing googlePayClient after onActivityCreated it gives this error: LifecycleOwners must call register before they are STARTED

I am upgrading the braintree SDK for google payment services in my recent project. For that purpose I need to initiate a BraintreeClient(this,token) which requires a token which is being fetched later after an API call for clientToken in…
0
votes
1 answer

Android RecyclerView items list doesn't change appropriately after chang settings and navigate again to fragment

I have single activity android application, a service app with task management. For navigation i use navigation component with bottom navigation. I also use data binding and Dagger2 DI, if it could be important for problem investigation. After user…
0
votes
1 answer

Use repeatOnLifecycle to collect a StateFlow's value but only receive the update when current fragment resume

When I collect a StateFlow's value in repeatOnLifecycle, I have to navigate to other fragment and back then can collect the value's change. But not once the value has been changed the collect lambda receives the change immediate without resume the…
0
votes
0 answers

Should we unregister the OnBackPressedCallback?

Starting from SDK 33 the onBackPressed() method is deprecated and as a replacement, I want to use the onBackPressedDispatcher property instead. To avoid memory leaks, should we somehow unregister the OnBackPressedCallback in the onDestroy method?
Patryk Kubiak
  • 1,679
  • 2
  • 11
  • 17
0
votes
1 answer

Flutter plugin - How to deregister Lifecycle listeners?

I am trying to implement a Flutter plugin and so I am checking the docs for ActivityAware And for onDetached it says this: void onDetachedFromActivity() This plugin has been detached from an Activity. Detachment can occur for a number of…
0
votes
0 answers

Pass verfication code phone authentication

i try to do automatic fill of sms code ,I am using firebase, in function oncodesent is send the code, and after that i want to pass the verficiation code to another functions, and the oncreate to use him , the problem is this method is void by…
N MZ
  • 121
  • 1
  • 1
  • 9
0
votes
1 answer

With LiveData observeForever what happen to the observer when the MainActivity is closed?

I have a service where I declare this liveData public static final MutableLiveData newMessageDispatcher = new MutableLiveData<>(); Inside the main activity I cannot do newMessageDispatcher.observe(myActivity, newMessageObserver) because my…
zeus
  • 12,173
  • 9
  • 63
  • 184
0
votes
0 answers

Unresolved reference: lifecycleOwner , why I get this error?

in my project I use a viewModel and live data, in the fragment I want to observe that live data from the viewmodel, I just want to set the lifecycleOwner but it doesn't exist at all in the generated binding class. although the same settings in my…
0
votes
0 answers

Unresolved reference: BaseViewModel

I found a problem to import my BaseViewModel on my BaseActivity. abstract class BaseActivity : AppCompatActivity() { } When I build, it appears on my Log: e: /.../core/src/main/java/com/clcmo/core/ui/BaseActivity.kt: (7, 33):…
0
votes
1 answer

Android NFC enableReaderMode stopped working; needed to delete and reinstall app?

We have an app utilizing NFC and recently migrated from enableForegroundDispatch to enableReaderMode. Since then, we have been receiving bug reports where the user intermittently has trouble scanning tags. I was troubleshooting remotely with a…
policenauts
  • 512
  • 6
  • 18
0
votes
0 answers

how to let android framework to instantiate a fragment that have a constructor parameter in save instance state

I have added a fragment in another fragment in this way Secondfragment secondFragment=new SecondFragment(parmater); fragmentManager.beginTransaction() .replace(fragmentContainerView.getId(), secondFragment, null) …
0
votes
0 answers

What is the difference between lifecycleOwner and viewLifecycleOwner?

I've been studying on how to use Data Binding with Live Data. I understood how to setup data binding with layout and variable instructions in the Layout and how to link up the data binding variable in the Fragment/Activity code. However, for my…
Amey079
  • 131
  • 7