S.Basnagoda
S.Basnagoda

Reputation: 721

How to keep SQLite queries in seperate text files and access them in Android?

I want to keep database creation queries and data accessing queries in text file format (those text files will be in a folder like "res" folder) and access them from android.

Let's say I want to execute the createDB() query, then I should be able to call by the relevant text file name and query should be executed.

I searched the internet and couldn't end up with a suitable tutorial or solution. So I am seeking some idea/solution or at least a good tutorial which satisfy my requirement.

Upvotes: 0

Views: 274

Answers (1)

Caner
Caner

Reputation: 59258

I don't know why you want to do that but this is how you can do it:

1) Put those files in assets folder
2) You can open them like this:

InputStream input = context.getAssets().open("example.xml"); 

Upvotes: 1

Related Questions