How can I copy 开发者_如何学Ca generic .db file (not part of my resources, like contacts.db) from the device filesystem to another location say sdcard? Can I use -
InputStream ins = getResources().openRawResource("path to my .db file");
And then proceed as you showed above.
Thanks in advance for your help
You can't copy "generic" db files anywhere, you can't even access them. They are private to the application that created the database and uses them.
See the Security and Permissions documentation for more info.
Of course, any .db files that you do have access to, those for your own apps, you can copy simply as files (though you'll want to make sure to close connections before doing so).
Applications like Contacts expose their data via a ContentProvider, but they do not allow you to access the db file directly (for obvious reasons).
精彩评论