Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top