Difference between getWritableDatabase() and getReadableDatabase()?

后端 未结 4 562
悲哀的现实
悲哀的现实 2020-12-29 14:11

I use reading and writing to the database without any problems . But I can not find out the difference. I searched on Internet but it \'s not quite clear. Can anyone tell me

4条回答
  •  不知归路
    2020-12-29 14:50

    Taken from my deleted answer here (this question is a duplicate of that one).

    In normal situations, getReadableDatabase() will return the same writable database returned by getWritableDatabase().

    However, should it not be possible to return a writable database, getWritableDatabase() will fail, whereas getReadableDatabase() will attempt to return a READ_ONLY database.

提交回复
热议问题