0
Hello, I have 3 apps, one makes insertion in the database and another shows a list of these data (do not ask me why this idea) and I needed a third show a record Count in a table of this database.
It turns out that in the latter the Count returns reset even if in the second app show items in the list.
I’ve been told that you may need to share contexts between apps, but how to do this?
EDIT: Already left in the comments that this is not the best option, so how to access data from another app database?
Theoretically, all the content of the context is in the package of the project you created. Which is why they recommended you, which is curious, I never had that problem...
– DH.
Your question is also lacking context:) Are 3 apps or 3 Activity? If you don’t have problems with the second one you shouldn’t have with the third one.
– ramaral
There are 3 apps. They gave me this recommendation. Which would be the best alternative?
– MayogaX
I can’t tell you because I don’t know what you want to do. In order for one app to access another’s BD, it has to implement one Contentprovider
– ramaral
In a simple case like this make the app, the one that has the BD, implement a Service to make available the number of registrations.
– ramaral
It’s just a Count, you can’t access the same db?
– MayogaX
Detail plus your question, which are the apps that uses the bank, is just one?
– gato
in the first sentence I said:one makes insertion in the database and another shows a list of these data (do not ask me why this idea) and I needed a third show a record Count in a table of this database.
– MayogaX
As ramaral said, you can use Contentprovider to share the data that in the case is the amount of records in a table, you can run a service that does this and controls the app calls. I believe that accessing the comic directly through a third app is more complex, to tell the truth I do not know if it is possible to do this.
– gato
Here you can see how to use the Contentprovider, and how to use the service.
– gato
The BD is private to the app that created it, so as far as I know, it is not possible for another app to access it except through the first one, via a Service or Contentprovider. You say you have a second app. that shows a list, how you’re doing this?
– ramaral
I’m using a normal Adapter and taking the data. I’m actually going through apps that someone else did
– MayogaX
You are confusing Activity with app. I think what you have is an app with two activities with
<category android:name="android.intent.category.LAUNCHER"/>
Pole the Androidmanifest.xml– ramaral
I got it here. Now the three applications access the same database, and no, I didn’t use Content Provider, it was direct connection.
– MayogaX
@Mayogax if possible post your solution as answer. In addition to being something recommended can help others with the same problem you’ve been through.
– gmsantos