0

I know that databases are stored inside the applications data folder how can i access the database from a separate application? Is there a way i can use a database in two separate apk's ?

3 Answers 3

3

If you define a Content Provider in your application then it can be accessed by other applications.

Sign up to request clarification or add additional context in comments.

3 Comments

Where i can find an example ?
There are lots of examples on the net. You may want to check this overview from Google first developer.android.com/guide/topics/providers/…
@opc0de The ContentProvider is the way to go if you want to access data from another application(that application will have to provide a ContentProvider). Besides the official tutorial that Alex provided, there is a simple app in the android samples that you should check out developer.android.com/resources/samples/NotePad/index.html .
2

You don't have to necesarily store the database in the applications data folder; if you put it on the sdcard instead, any app can access it.

Generally you'd probably indeed prefer a server instead, but I felt this was still worth mentioning.

Comments

0

in general, an application's DB can be accessed only by that app. if you want to use the same DB for multiple apps you may want to try using a server instead.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.