android中关于Sqlite的问题

1.不要在UI线程里调用getReadableDatabase ()或者getWritableDatabase ()方法

    参见androidAPI文档如下:

    Create a helper object to create, open, and/or manage a database. This method always returns very quickly. The database is not actually created or opened until one of getWritableDatabase() or getReadableDatabase() is called.

    Like <a target="_blank" href="https://www.ancii.com/link/v1/7DZIIP7vza1Pnnr0kWwZDlDq67HmDIRy5PR72-lz1H8NrlqM0NlyPI6MFJtbkDWisUswIGdDC5eOwg_UISgZMZCYV3wuDbYsTCuHetXRuDF4fGQceIZQ3BiDgrGK6OROqTxsISwz4ngJoYtdVdkT8w/" rel="nofollow" title="getWritableDatabase()">getWritableDatabase()</a>, this method may take a long time to return, so you should not call it from the application main thread, including from <a target="_blank" href="https://www.ancii.com/link/v1/7DZIIP7vza1Pnnr0kWwZDlDq67HmDIRy5PR72-lz1H8NrlqM0NlyPI6MFJtbkDWiQAYh6qVtwCQwSRgkykQpHOSleWL1Zrg_TT4C8WiA8g_N-LtwLxmf3CaoD_LIfIwf/" rel="nofollow" title="ContentProvider.onCreate()">ContentProvider.onCreate()</a>.

     Database upgrade may take a long time, you should not call this method from the application main thread, including from <a target="_blank" href="https://www.ancii.com/link/v1/7DZIIP7vza1Pnnr0kWwZDlDq67HmDIRy5PR72-lz1H8NrlqM0NlyPI6MFJtbkDWiQAYh6qVtwCQwSRgkykQpHOSleWL1Zrg_TT4C8WiA8g_N-LtwLxmf3CaoD_LIfIwf/" rel="nofollow" title="ContentProvider.onCreate()">ContentProvider.onCreate()</a>.