Creating a database in the blackberry device when the app is installed
I want to create a database on my blackberry device when my app is installed. I did not find any event (e.g. onInstalled) so that i can create my databse on this event when the app is installed. Apparently there is a method DatabaseFactory.exists() which i can use to check if the database exists or not. But i do not want to check for this every time. I want to create the database when my app is installe开发者_运维问答d and when the app is un-installed then the database should also get deleted. Thanks
As far as I know RIM API SDK does not provide mechanism to catch install/uninstall events. And even the database is once created it can be deleted/damaged via the filesystem. For instance user deletes database files from the media-card or from the device memory. Just because user does not know what these files contain and assumes these as temporary or something else.
It is a good approach to check the database presence before starting work with it. Otherwise user may get blank white screen with text "Exception 1234" and some additional text, or may get a popup with strange message, like "Error: FileNotFoundException...".
See the SQLiteDemo in the blackberry samples demo then you can get solution.
精彩评论