Package 

Class MessageDatabase


  • 
    public class MessageDatabase
    
                        

    Class for simple interaction with database containing messages.

    When the first read or write requests are made, database will be 'opened' and later should be close manually via close method. If database has been 'closed' but new read/write request is made then it will be opened again and will have to be closed again.

    Simple interactions with database are fast and can be done on main thread. However, there are exceptions. For example, if there is a massive data to write or database needs to change its structure (onUpdate/onDowngrade/onCreate) it could block caller thread for some time. So it is recommended to call all read/write methods from worker thread. See great article on Android DB: https://www.grokkingandroid.com/sqlite-in-android/