How to share the bank with two android apps?

Asked

Viewed 63 times

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?

  • 1

    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...

  • 1

    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.

  • There are 3 apps. They gave me this recommendation. Which would be the best alternative?

  • 1

    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

  • 1

    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.

  • It’s just a Count, you can’t access the same db?

  • Detail plus your question, which are the apps that uses the bank, is just one?

  • 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.

  • 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.

  • Here you can see how to use the Contentprovider, and how to use the service.

  • 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?

  • I’m using a normal Adapter and taking the data. I’m actually going through apps that someone else did

  • 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

  • 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 if possible post your solution as answer. In addition to being something recommended can help others with the same problem you’ve been through.

Show 10 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.