android-architecture-lifecycle Questions

7

Solved

I tried to add a unit test for my function which supports architecture components lifecycle event. To support lifecycle event, I added the @OnLifecycleEvent annotation for my function which I want ...

7

Solved

I have a need to transform one type of data, returned by a LiveData object, into another form on a background thread to prevent UI lag. In my specific case, I have: MyDBRow objects (POJOs consis...

4

Solved

I am using Bottom Navigation with Navigation Architecture Component. When the user navigates from one item to another(via Bottom navigation) and back again view model call repository function to fe...

3

I am trying to test a simple ViewModel with Robolectric. Here's my ViewModel GreetingsViewModel.kt @FlowPreview @ExperimentalCoroutinesApi class GreetingsViewModel : ViewModel() { private val...

2

Solved

I have a LiveData object that depends on another LiveData. As I understand, Transformations.switchMap should allow to chain them. But switchMap handler is triggered only once and it doesn't react o...

2

Solved

I'm adopting MVVM to my Android apps recently. In order to solve the problems underlying with the lifecycle of an app, Google had released LiveData. The usage of LiveData has different scenarios,...

1

Solved

My app is crashing on launch with a LinkageError when creating a view model using lazy{}. The crash only happens when: minifyEnabled is set to true in build.gradle, AND I use ver. 2.1.0 of life...

6

I have a ViewModel named SharedViewModel: public class SharedViewModel<T> extends ViewModel { private final MutableLiveData<T> selected = new MutableLiveData<>(); public voi...

3

I am using Android Support Library 26.1.0. These are the dependencies in the app module: implementation "android.arch.lifecycle:runtime:1.0.0" implementation "android.arch.lifecycle:...

3

Solved

I have read the document about Life Cycle and Live Data in the android official documentation. I know the class implemented LifeCycleObserver and make the location listener closed or open automatic...

2

Solved

This is a very simple question: Background I'm using the relatively new Lifecycle class (part of the android architecture components libraries) to handle some events of the Activity/Fragmen...

2

Solved

Since recently my app started to contain strange error messages in the pre-launch reports (automatically generated after upload to the Play store). These reports contain exceptions such as the fol...

0

I'm working on an inventory application based on Architecture components (ViewModel/Room/Livedata) and RecyclerView. The app based on the practise that Google recommends in Developer training book....

1

Solved

I am using architecture component view model's LiveData to populate recycler view and want to add a searchview filter but couldn't find any solution. I tried to use filterable interface in the adap...

2

Solved

Recently I updated android.arch support library version in gradle file // ViewModel and LiveData implementation "android.arch.lifecycle:extensions:1.1.1" // alternatively, just ViewModel imp...

1

Solved

I currently use LifecycleObserver for notifying about events such as onStart of my view. This is great for components as presenters or handlers, such as FacebookLoginHandler that needs to register ...

3

Solved

My question is related to ViewModel second time returns null wherein I am not getting callback inobserve function if I make a repeated call to server. Following is the code I am using - @Singleton...

4

Solved

I've started learning architecture components, but can't find one thing. LifecycleFragment just creates a new LifecycleRegistry object, which does not start observing the fragment's lifecycle. I ...
Ouachita asked 16/6, 2017 at 17:28

2

Solved

I had an Activity that extended AppCompactActivity, and in onCreate method I setted the Toolbar using setSupportActionBar method in the usual way: public class StepMasterActivity extends AppCompat...
1

© 2022 - 2024 — McMap. All rights reserved.