I would like to know please how to get my database(which is off course *.sqlite file) size in bytes?

My current way to do it(which isn't working) is: new File(DataManager.getInstance().db.getPath()).length()

but I'm just getting here the same number every time 53,676~ , which is irrelevant to the database's content, I'm getting this number even when it's empty.

Thank you.

有帮助吗?

解决方案

OK the solution is pretty simple, my recent way to check the database file was good. But I didn't take in account that greenDao adds to the database another 53 KB. So an empty DB size would be 53± KB and after some insertions it would get bigger and bigger.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top