68 questions
Best practices
0
votes
1
replies
58
views
Best practice for localizing a large (16,000+ rows) SQLite database in android
The core of my app is an SQLite database containing over 16,000 strings.
My goal is to translate them into multiple languages in the most performant, memory-efficient, and maintainable way.
I ...
2
votes
0
answers
85
views
Proper way to share app settings state across all screens in Jetpack Compose: CompositionLocal
I’m developing a water-tracking app where a setting like volumeUnit (mL/L) needs to be accessible across almost all screens. I’ve implemented a SettingsManager (using DataStore) and a ...
0
votes
2
answers
228
views
When using Clean Architecture in Android projects, why does the Presentation Layer need to have a dependency on the Data Layer? [closed]
Looking at many blog posts and GitHub projects, I've noticed that when implementing Android project with Clean Architecture, the Presentation Layer often has dependencies on the Data Layer. I'm not ...
0
votes
1
answer
378
views
How Can I Integrate Dagger in the Domain Layer and Hilt in the App and Data Layers of an Android Application following CLEAN architecture principles?
I am new to Android development and currently delving into app architecture, specifically the separation of concerns across different layers (domain, data, and app). My understanding is that the ...
11
votes
2
answers
2k
views
Android multi-module architecture: domain depends on data or vice versa
Some Android multi-module architecture examples show that domain layer depends on data. Others are vice versa.
Android Developers site says:
The domain layer is an optional layer that sits between ...
1
vote
0
answers
116
views
Resolving image URLs from a Composable
To resolve an image URL by width and aspect ratio I need to know the specific image URL schema that my image API uses. The width and aspect ratio is known in my UI module while the schema ...
0
votes
1
answer
2k
views
How to keep a flow alive on errors / restart it?
In my Android ViewModel I have code like this:
try {
myRepository
.getAllData()
.catch {
Timber.e("catch exception case 1")
Timber.e(it)
}
...
0
votes
0
answers
405
views
Exposing errors to the UI from the data layer via exceptions?
In the Android architecture guide for the data layer, the usage of exceptions instead of a Result<T> class is recommended.
For errors that could be triggered by suspend functions, use try/catch ...
0
votes
1
answer
172
views
Multiple android app projects sharing code in Clean-Architecture
I want to create three related android apps (employee, Manager, Secretary) in clean-architecture and also share common classes (utils, Ui & etc.) among all three apps in order to reduce code ...
0
votes
1
answer
64
views
Handle display of string or string resource
Suppose you apply the following architecture in your Android project:
View - ViewModel - UseCase - Repository and you have to display some text from the UseCase layer to the View layer. However, this ...
0
votes
1
answer
70
views
Android MVVM UI-realated class size
I'm working on a relatively big Android project. This project's app architecture is MVVM, and all layer responsibilities are separated well enough. Still, as this project is getting bigger, it's hard ...
5
votes
1
answer
6k
views
multiple View Models for each screen
Hello devs I have one questions I hope you can help me.
I have read that Google recommends having a View Model for each screen, a screen could communicate with the View Model to perform many different ...
9
votes
1
answer
5k
views
Best practice for using Shared Preferences in MVVM Android?
I've been searching for the best approach to using Shared Preferences in MVVM architecture in Android but I could just find pieces and thus having no clear image over ho to do it in the best way. ...
1
vote
2
answers
2k
views
Correct way to pass events back from a view in Android
I've been following the UI architecture laid out in this article https://developer.android.com/jetpack/guide/ui-layer which essentially amounts to this:
It works great, but there is no example given ...
3
votes
1
answer
2k
views
Update part of UI using MVI on Android
One thing I have understood about MVI, is that the model creates the state and the view handles it. The view ALWAYS gets a FULL state from the model, meaning that every state given to the view ...
0
votes
1
answer
763
views
Can we call firebase as a server?
I am using firebase for storing data through android application. I want to architecture diagram for that application, so can I call the firebase as a server? I am trying to use client server ...
3
votes
1
answer
635
views
Where should I do the mapping? How can I do the mapping on repository? Datasource or Repository?
I'm implementing a clean architecture design: ui -> domain <- data in modules (this is important) and I've encountered a trouble.
I have the Repository and the DataSource. I create the ...
1
vote
0
answers
312
views
Work with Hilt with submodules of a feature module
Is there any way to make dagger hilt work with clean architecture that uses the presentation-domain-data as submodules?
For example I have Feature A as a module. This module has 3 submodules:
...
1
vote
1
answer
878
views
ViewModel with Application context and extra parameter in Fragment
We knew that in order to access Application context like need to find a resource string or system service we extend our ViewModel with AndroidViewModel while passing extra arguments to a ViewModel ...
0
votes
1
answer
854
views
The better way of Error Handling In Android
Let's say I have this architecture in my app
My question is when is the best time to handle the error?
Should I let the network source and cache source throw an error, and we handle all the possible ...
1
vote
2
answers
465
views
How to navigate to a fragment from a class extending BroadcastReceiver using the new Navigation Architecture Components
I am having my Broadcast Receiver which is supposed to scan incoming messages and pass the originating address and message to a new fragment using bundles and using the new Navigation Architecture ...
1
vote
2
answers
148
views
Best way to pass data needed for a later (not following) fragment?
I have an application that needs to collect some data before doing it's main job.
So, the first fragment collects data, the second fragment collects data and then the third fragment uses the data.
The ...
1
vote
3
answers
2k
views
Jetpack Navigation Component handle navigation controller with Bottom Navigation and it's Back Stack navigation
Hello i am developing one application and i am stuck on navigation in Navigation View.
Example I have activity and inside i have define navigation host controller like below
setSupportActionBar(...
1
vote
0
answers
203
views
Android Room @Embedded @Relation Class file location
I had an argument with my co-worker about where we put class file that uses @Embedded @Relation annotations.
Do they count as Entities ? or should we create another package for them ? I have seen some ...
1
vote
1
answer
864
views
android modularisation - Get a call back from another module when launched through Intent
I am currently working on android modularisation. I have a scenario if Module A during API call (Unauthorised) launches activity in Module B(Login Module). Can we have a call back to module A whether ...
2
votes
0
answers
227
views
What is the best option to create a dynamic board game on Android?
I want to develop a dynamic matching game for Android. I want the change the board size from 4x4 up to 8x8 (eg. 7x4 and 5x4 would be valid sizes), depending on the level of difficulty chosen. This ...
2
votes
0
answers
1k
views
When should you use @Embedded/@Relation versus @ForeignKey relationship with Android room?
After looking through the android documentation and many blog posts/youtube videos, it's still unclear to me when one would favor using @Embedded with @Relation versus using a @ForeignKey relationship....
0
votes
1
answer
273
views
How to use livedata in an MVVM architecture
TLDR: How could I properly implement an MVVM architecture with LiveData?
I have a fragment class that observe a viewModel exposed livedata:
viewModel.loginResultLiveData.observe
class LoginFragment : ...
9
votes
1
answer
9k
views
Passing data from one viewmodel to another android MVVM
I have a design-related question for you guys.
So, I have been following Guide to App Architecture by Google to build my application using Kotlin, MVVM and data binding. I am using Jetpack components(...
2
votes
1
answer
6k
views
How to Include 64-bit and 32-bit native code in my app
I can't uplaod my app to playstore got this error
I have also build "Android App Bundle" to upload the app but again got this error.
This release is not compliant with the Google Play 64-bit ...
1
vote
2
answers
2k
views
how to make project 64 bit compatible
Recent changes in android architecture have enforced all developers to make their android applications support 64bit.
I have gone through the documentations. But as it shows there to look for a "lib" ...
2
votes
1
answer
109
views
Why 32 bit and 64 bit Android application give different /proc/cpuinfo : feature list
We have Android 32 and 64 bit variant of our application and when we try to read /proc/cpuinfo we get different value of "features".
For eg. If 64 bit application reads /proc/cpuinfo value of feature,...
1
vote
0
answers
789
views
What's a reliable way to persist the current logged in user in a clean android architecture?
I've been searching for a clean, reliable way to persist the current user in an Android app, which is accessible from any activity/view, is available immediately, and can be reliably cleared upon ...
2
votes
0
answers
108
views
BoundaryCallback for PagedList never gets called
I've created a Room Database on my device, which returns
// The Int type parameter tells Room to use a PositionalDataSource object.
@Query("SELECT * FROM Word ORDER BY id")
abstract fun getByFactory(...
11
votes
1
answer
5k
views
How to share dependencies in a Modularized Android App
I have an Android project which is architectured in a Modularized way. I have modularized the projects by dividing their source code between multiple Gradle modules, following the clean Architecture.
...
1
vote
1
answer
114
views
Why is todo-mvp-dagger, not todo-mvvm-dagger?
https://developer.android.com/topic/libraries/architecture/
In the Android architecture blueprint, why is dagger based on the mvp architecture rather than the MVVM architecture? Is it because it is ...
93
votes
6
answers
22k
views
BoundService + LiveData + ViewModel best practice in new Android recommended architecture
I been struggling a lot thinking about where to place Android Services in the new Android recommended Architecture. I came up with many possible solutions, but I cannot make up my mind about which one ...
3
votes
2
answers
2k
views
Can I use Room Persistence for a different type of Database?
I know that room is an abstraction layer over SQLite, I just want to know if I can use it for a different type of Database. I want to use Room to a special version of SQLite with geospatial support, ...
7
votes
0
answers
1k
views
How to add swipe left or right in Tabs of tab layout when implemented using Navigation Architecture component
One way to implement swipe in Tabs of TabLayout is using viewpager. Using navigation architecture component for navigation it is not clear how to use viewpager. If we are not using viewpager, what is ...
6
votes
2
answers
2k
views
Does event wrapper pattern replace the use of SingleLiveEvent?
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, as ...
0
votes
0
answers
105
views
Modular android app without RX java or RX android
I had gone through this github app,
Buffer app GitHub Link
I loved this project and devoted my lot of time to understand it quite nicely. But the only problem is that i want to do it without RX java,
...
0
votes
1
answer
669
views
android MVVM What's the right way to setViewModel to Fragment
I am practicing Google MVVM https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding, having a problem of linking Fragment and ViewModel.
The google demo doing like this:
in ...
2
votes
1
answer
3k
views
Room Query not working
I'm trying to use Room with LiveData in my project. In my app, I have the authors table. The data is inserted fine but when I'm trying to read something from the table it did not give me records. I ...
14
votes
6
answers
17k
views
Androidx and databinding
I'm migrating my dependencies for an Android P test to the androidx dependencies. For some not very clear reasons my project does not compile anymore (and no I won't provide the details to avoid a ...
0
votes
0
answers
345
views
Hide internal classes of a library
When developing an android library, is it possible to hide internal classes so they're not available for the one who uses the library?
Suppose there is a module sdk. Let's suppose that someone ...
0
votes
0
answers
376
views
detecting neon support
I've built ffmpeg for different cpus for using on android and i would like to know to detect them on runtime (in java) in order to select which binary i'm going to use
On android documentation i ...
4
votes
1
answer
2k
views
Is it ok for view to ask for data from ViewModel in MVVM?
I have been reading about MVVM pattern. View is supposed to observe for changes in ViewModel and act on it accordingly but I am confused if following code in View is ok in MVVM architecture.
fun ...
1
vote
0
answers
328
views
How to organize architecture of displaying two different Fragments in activity?
I have some sort of architecture issue:
I have Activity in which I need to show one of 3 views (one view at one moment in time):
1. One view with stable AppBarLayout + another part of the screen is
...
0
votes
0
answers
47
views
Dagger reference module from child class at runtime
I'm having android libraries LBase, L1, L2 with dependency like LBase->L1 and LBase -> L2. And android Apps A1 built from L1 and A2 built from L2
In LBase
public interface iA {
}
public A ...
3
votes
2
answers
1k
views
Multiple fragment in one Activity in Android MVP
I was working with Android MVP architecture and I am following Google MVP Architecture.
I am facing issue when Activity have multiple fragment,In my case activity having 2 tab. I am not able to ...