Get Phone memory size

Source: Internet
Author: User

1 PrivateString gettotalmemory () {2String str1 = "/proc/meminfo";//system memory information file3 String str2;4 string[] arrayofstring;5         LongInitial_memory = 0;6         Try {7FileReader Localfilereader =NewFileReader (str1);8BufferedReader Localbufferedreader =NewBufferedReader (9Localfilereader, 8192);TenSTR2 = Localbufferedreader.readline ();//read Meminfo First line, total system memory size One  Aarrayofstring = Str2.split ("\\s+"); -              for(String num:arrayofstring) { -LOG.I (str2, num + "\ T"); the             } -  -Initial_memory = integer.valueof (Arrayofstring[1]). Intvalue () * 1024;//gets the total system memory, in kilobytes, multiplied by 1024 to byte - localbufferedreader.close (); +  -}Catch(IOException e) { +         } A         returnFormatter.formatfilesize (Getbasecontext (), initial_memory);//byte converted to KB or MB, memory size normalized at}

Get Phone memory size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.