Wednesday, April 10, 2013

[android help] How to restrict file size while writing to text file from an Android app

How to restrict file size while writing to text file from an Android app - Stack Overflow




















My Android App continiously writing logs in a .txt file. I want to restrict this file size.ie, if file size exceeds 1MB it will not write any more log and notification will be sent to the user that no more space in your log file.How can I implement that?





























try this code for calculating size:



File file = new File("text.txt");
long filesize = file.length();
long filesizeInKB = filesize / 1024;
long filesizeinMB=filesizeInKB/1024;



















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...