Answer the question
In order to leave comments, you need to log in
Why is a ContentProvider needed in a single project?
Hello everybody!
For the life of me, I can’t understand why I need to use ContentProvider when working with data (SQLite) in an application, if I am not going to provide access to any other application?
The official Google documentation also says that it was created to provide data "outside". In my next question ( https://toster.ru/q/317954), a kind person (thanks to him again for the answer) advised me to use it too. After reading about him came to this question.
Is there really no way to organize data access without it (elegantly)? For example, do something like a repository, but only without a provider
There was advice to use ContentProvider + CursorAdapter + CursorLoader, but then it is necessary to have the "_id" field in the database, which I basically do not need if I have a GUID (UUID). Again, is there anything without it?
Answer the question
In order to leave comments, you need to log in
You are looking for a unique solution, for all occasions. But this is not always the case, each task requires its own solutions.
Yes, it all depends on the task. And habits.
Depends on many things from the requirement to whether this code will be supported.
You can also make a repository with direct SQL queries or using a cursor. Depends on the project.
You are looking for a unique solution, for all occasions. But this is not always the case, each task requires its own solutions.
Perhaps specifically in your case, the use of a content provider is the same as setting Bitrix for a two-page business card site.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question