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
1 answer

LiveData observer triggered after reloading fragment when start new fragment but AlertDialog not

I have a LiveData observer on LiveBarcodeScanningFragment that observes barcode live data, after which if detected, BarcodeBottomSheetFragment will start (extend Fragment instead of BottomSheetDialogFragment which have more animations). But here's…
0
votes
0 answers

Compose navigation lose state after pop screen (initial composition)

I am using compose navigation with single activity and no fragments. class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { …
0
votes
2 answers

Cannot create an instance of Application ViewModel

I'm Trying to make a viewmodel scoped to my application to control logic related to showing of not showing pin in multi activity app . I've used AndroidViewModel to pass the application to it and here is the class for AppViewModel …
0
votes
2 answers

Using ViewModelProvider get with key results in IllegalArgumentException:SavedStateProvider with the given key is already registered

I would like to get separate instances of a ViewModel class from a fragment. I tried @AndroidEntryPoint class MyFragment: Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view,…
rysv
  • 2,416
  • 7
  • 30
  • 48
0
votes
1 answer

email is not verified

in my application first i authenticate user email and then i am verifying user email i have set dialog activity to inform user to check email and verify email i have close button in dialog activity if user click on it dialog will be dismissed i have…
0
votes
1 answer

How to load the recycler view adapter on resume event

I have a fragment which displays a list in recyler view (chargeHistoryList). all the code is written in onActivityCreated, so this gets called only once when the fragment is called. onResume method is pretty blank at the moment. Issue I am having…
BRDroid
  • 3,920
  • 8
  • 65
  • 143
0
votes
2 answers

How can I stop activity being added to backstack

how can I avoid adding an activity to a backstack. This is how I start an activity startActivity( StripeConnectActivity.createIntent( context = baseContext, paymentSetupState = paymentSetupState, …
BRDroid
  • 3,920
  • 8
  • 65
  • 143
0
votes
2 answers

Android. Repository with global lifecycle

I have a repository where a chain of network requests is calling. The repository is accessed from the interactor. And interactor is accessed from viewModel. The view model is attached to activity A. If I go to activity B, which has its own…
0
votes
0 answers

Android 12 (API 31) - Fragment not being destroyed when going in background

I'm having this issue with my fragment only in API 31. In the host Activity I use replace to add my fragment: transaction.replace(container, fragment, tag); Everything runs as expected. But when I send the app in background in API 31 the fragment's…
0
votes
0 answers

Android: Encountering RuntimeExceptions and NullPointerException while using Camera with ActivityResultLauncher

My objective: The user will click a floating action button which will open a camera. User will then take a picture with it. If the image is okay then the captured image will be loaded to another activity. Problem: After the user captures image and…
ganjaam
  • 1,030
  • 3
  • 17
  • 29
0
votes
0 answers

How to prevent my Flutter app from closing when pressing the home button or when minimized?

When ever I put my flutter app into the pause state, it instantly detached itself. How do I prevent this? I want to resume where I left off when I minimized my app.
Leon
  • 1
  • 1
0
votes
0 answers

How to collect flow data after view is complete initialise in Android kotlin

Hey I am working on Kotlin flow. I am working in ViewPager2 with Paging 3 Library. I am getting some bug which caused indexing issue in ViewPager2. Someone suggested me use lifecycleScope.launchWhenCreated but it not working correctly. According to…
Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127
0
votes
1 answer

Android service doesn't rebind to camera when respawned

I run a service that analyzes frames in the foreground. It works fine from the moment I start the service until it gets killed. From that moment, when it respawns, I don't see the same message as before (saying X App is using your camera), although…
0
votes
1 answer

Why my savedInstanceState is not working?

I'm new to android studio with kotlin. I want to make multiple choice quiz app, and I use data class and object constant to supply problem. If users choose correct choice, private var mCurrentPosition(Int) get plus 1 and setQuestion() work to…
Jamieson
  • 3
  • 1
0
votes
2 answers

I get map object null on onStart() method

I'm trying to addMarker when I open my fragment so in onMap Ready function I assigned my map and I'm calling map onStart() method but I get null @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { map =…
1 2 3
99
100