Reputation: 441
For the Android app that I'm working on I have to do some lengthly sqlite queries, and it was making my code hard to follow. Is there any way I can put the queries into an XML file and then load them from there?
I'm attempting to do something similar to this.
Upvotes: 2
Views: 780
Reputation: 1733
You could create an XML file like the one you linked to under the res/xml/
directory, or use the res/raw/
directory and store it in some other format of your choosing. Then read the resource in as you normally would with Android, parse it if necessary, and interact with your database directly by using SQLiteDatabase.execSQL
.
For specifics, it really depends on your needs and application architecture.
Upvotes: 2