android-architecture-components Questions

5

Solved

I'm trying to write simple integration test in my current android project written totally in Kotlin. The problem is that the test doesn't even start and fails with the following error: Error:(4, ...

3

I have an abstract BaseActivity in my library module: @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Normal method to inflate th...

36

I'm converting a project to Kotlin and I'm trying to make my model (which is also my entity) a data class I intend to use Moshi to convert the JSON responses from the API @Entity(tableName = "movi...

16

Solved

What is the difference between those 2 methods of the LiveData class? The official doc and tutorial are pretty vague on that. In the map() method the first parameter called source but in the switch...
Mauchi asked 30/11, 2017 at 14:36

7

Solved

I am trying to understand ViewModel and LiveData concepts in android. I am making a practice project but when i added implementation 'androidx.lifecycle:lifecycle-extensions-ktx:2.0.0-alpha1' line ...

14

Solved

I have next use case: User comes to registration form, enters name, email and password and clicks on register button. After that system needs to check if email is taken or not and based on that sho...

32

Solved

Error:Not sure how to convert a Cursor to this method's return type Error:Execution failed for task ':app:compileDebugJavaWithJavac'. Compilation failed; see the compiler error output for details. ...

2

I would like to refactor my Custom View to use android architecture components. However, I see that ViewModelProviders.of(...) takes only Activity or fragment. Any idea how to make it work? Sho...
Mussorgsky asked 28/3, 2018 at 11:3

12

Solved

I'm working on a small project and trying to use the new navigation architecture components. When i'm trying to add some arguments to a destination i got "Unresolved reference: NavArgs" error. I f...

18

Solved

Is it possible to prevent LiveData receive the last value when start observing? I am considering to use LiveData as events. For example events like show message, a navigation event or a dialog tri...

13

Solved

I have an activity A that start activity B passing to it some intent data. Activity B host a navigation graph from the new Navigation Architecture Component.I want to pass that intent data to the s...

2

I am following MVVM architecture for my app. In Activity I need to getNews() from a URL, if news is not already cached. Activity will ask ViewModel to give the News Json and ViewModel will look in...

15

Solved

My understanding on LiveData is that, it will trigger observer on the current state change of data, and not a series of history state change of data. Currently, I have a MainFragment, which perform...

10

Solved

I have a separate class in which I handle data fetching (specifically Firebase) and I usually return LiveData objects from it and update them asynchronously. Now I want to have the returned data st...

13

Solved

Edit: This question is a bit out of date now that Google has given us the ability to scope ViewModel to navigation graphs. The better approach (rather than trying to clear activity-scoped models) w...

5

Solved

I have one entity in room @Entity(foreignKeys ={ @ForeignKey(entity = Label.class, parentColumns = "_id", childColumns = "labelId", onDelete = CASCADE), @ForeignKey(entity = Task.class, parentCo...

3

Solved

I have three top-level destination fragments in my activity: appBarConfiguration = AppBarConfiguration( setOf( R.id.trackerFragment, R.id.nutrientFragment, R.id.settingsFragment ), drawerLayo...

2

I'm using the Android Paging 3 library in my project in order to load my data page by page. In this project, I'm not using database which means I'm using network only requests. The problem is that ...

5

Solved

I am new to android development and I am trying to make a notes app by following the android architecture components but on running I am getting errors in my DAO if any one could help would be high...

4

I am using paging library to load data and populate my recyclerview which is placed inside a nestedscrollview. But it is like, pagination works automatically until all the data fetched from API. I ...

7

Solved

In recent Android Architecture Components library released by Google, we have two static functions in the Transformations class. While the map function is straight forward and easily understandable...
Satisfied asked 2/12, 2017 at 17:42

2

Solved

I'm trying to implement Android ListenableWorker that startWork() method returns com.google.common.util.concurrent.ListenableFuture interface, but the last one isn't available. Also I need com.goog...

21

Solved

I am using The new Navigation Architecture Component in android and I am stuck in clearing the navigation stack after moving to a new fragment. Example: I am in the loginFragment and I want this...

4

Solved

On 7th May, 2019 androidx.lifecycle:*:2.2.0-alpha01 was released announcing: This release adds new features that adds support for Kotlin coroutines for Lifecycle and LiveData. Detailed documenta...

36

Solved

I am trying to write a sample app using Android architecture components and but even after trying for days I could not get it to work. It gives me the above exception. Lifecycle owner:- public cl...
Corinnacorinne asked 9/7, 2017 at 15:30

© 2022 - 2024 — McMap. All rights reserved.