Why you need a ContentProvider in a single project?

Hello everybody!
Here though kill, but I can not understand why you need to use a ContentProvider for data (SQLite) within the application if no other application I access not going to provide?
In the official documentation Google also says that it is designed to provide data "out". Once my question(https://toster.ru/q/317954) me good man (I thank him again for the answer) advised also to use it. After reading about it came to this issue.
Is it does not provide access to the data(elegantly)? For example to do something like repository, but without provider
Was the advice to use ContentProvider+CursorAdapter+CursorLoader, but then you need in the database have a field "_id" that I don't want or need, if I have a GUID (UUID). Again, without this in any way?
July 9th 19 at 12:58
2 answers
July 9th 19 at 13:00
Solution
Are you looking for a unique solution for all occasions. But not always happens, each task requires its own solutions.

+1

But then I can't use CursorLoader c CursorAdapter. Or am I mistaken?

Yes, if the field is not _id is inaccessible to a number of native features of the sdk even by clicking on a list item you won't get the key (out of the box if PK _id clicked on a list item you will get its _id)

In fact _id is standard for android, so except in cases where for some very important reasons you need to name the PC as something else, I would recommend to call a PK _id

For example to do something like repository, but without provider

Of course you can, but then a number of features you have to cut yourself

I like ContentProvider for its simplicity, but don't like the curve of api (no, really, a method in which almost all the parameters often null in 2016 is a Chur) but its api kompensiruet its stability
once more describe a case of its use when you do not need to give it access

Client spherical online store
for clarity, let's imagine that we have a tablet and that the screen is divided into 2 fragments
the first piece of tape products
the second basket
(Yes a weird ux, but what to do .... )

in the tape, the user presses the button add to cart, while magically updated ui in the second fragment if no complex logic is to realize it does not need

I think the same effect can be achieved when using rxjava but will have to sweat
Glad to see You))) On account of example, this you describe is the case when using the ligament Loader+Adapter+ContentProvider get rid of the bikes? - Reuben56 commented on July 9th 19 at 13:03
: yeah ))) - xavier.Breitenberg21 commented on July 9th 19 at 13:06
July 9th 19 at 13:02
Yes all in General depends on the task. And habits.

Depends on many things starting from requirements and ending will this code be supported.

You can make a repository with direct SQL queries, or using the cursor. From the project depends.

Are you looking for a unique solution for all occasions. But not always happens, each task requires its own solutions.

It is possible particularly in your case, the use of the content provider, the same as for two page business card site to put Beatrix.
And when it in this case (for example) must be used if no access do not need to give? How to bypass restrictions _id? - Reuben56 commented on July 9th 19 at 13:05
: Google says that it should be used only if you are going to fumble the content. But the circle of crazy hands sometimes sells it directly, from the category of need. I have met people who like to use it inside the app.

about _id not understand your hatred. Don't use. Write the repository with a cursor or sql queries. Make it a selection by GUID and all. - xavier.Breitenberg21 commented on July 9th 19 at 13:08
: But then I can't use CursorLoader c CursorAdapter. Or am I mistaken? - Reuben56 commented on July 9th 19 at 13:11

Find more questions by tags Android