Details on how to view Android system information

Source: Internet
Author: User

If you want to view the specific system information in the Android mobile operating system, such as the memory size and system performance. What is the specific operation method? Here, we can fully master this operation method to facilitate our understanding of this mobile phone system.

Today, we will talk about how to view the mobile phone attributes, memory usage, and other information in the Android system information, which has become a household name on the Android system. What about Android? In fact, it is also very simple, just look at the following code.

 
 
  1. Package com. srk. study. system;
  2. Import android. app. Activity;
  3. Import android. app. ActivityManager;
  4. Import android. widget. TextView;
  5. /**
  6. * Gphone Test Tool
  7. * @ Author shenrenkui
  8. */
  9. Public class SystemProperty extends Activity {
  10. /**
  11. * Display the Data Inventory
  12. */
  13. Private StringBuffer buffer;
  14. @ Override
  15. Protected void onStart (){
  16. Super. onStart ();
  17. InitProperty ();
  18. GetMemoryInfo ();
  19. TextView TV = new TextView (this );
  20. TV. setText (buffer. toString ());
  21. This. setContentView (TV );
  22. }

How to view Android system information

 
 
  1. private void initProperty() {  
  2. initProperty("java.vendor.url", "java.vendor.url");  
  3. initProperty("java.class.path", "java.class.path");  
  4. initProperty("user.home", "user.home");  
  5. initProperty("java.class.version", "java.class.version");  
  6. initProperty("os.version", "os.version");  
  7. initProperty("java.vendor", "java.vendor");  
  8. initProperty("user.dir", "user.dir");  
  9. initProperty("user.timezone", "user.timezone");  
  10. initProperty("path.separator", "path.separator");  
  11. initProperty(" os.name", " os.name");  
  12. initProperty("os.arch", "os.arch");  
  13. initProperty("line.separator", "line.separator");  
  14. initProperty("file.separator", "file.separator");  
  15. initProperty("user.name", "user.name");  
  16. initProperty("java.version", "java.version");  
  17. initProperty("java.home", "java.home");  
  18. }  
  19. private void initProperty(String description, 
    String propertyStr) {  
  20. if (buffer == null) {  
  21. buffer = new StringBuffer();  
  22. }  
  23. buffer.append(description).append("--->:");  
  24. buffer.append(System.getProperty(propertyStr)).
    append("\n");  

View memory in Android system information

 
 
  1. Private void getMemoryInfo (){
  2. Final ActivityManager activityManager =
    (ActivityManager) getSystemService (ACTIVITY_SERVICE );
  3. ActivityManager. MemoryInfo outInfo =
    New ActivityManager. MemoryInfo ();
  4. ActivityManager. getMemoryInfo (outInfo );
  5. Buffer. append ("\ n remaining memory: ---->"). append
    (OutInfo. availMem> 10). append ("k ");
  6. Buffer. append ("\ n remaining memory: ---->"). append
    (OutInfo. availMem> 20). append ("M ");
  7. Buffer. append ("\ n is in the low memory status: -----> ").
    Append (outInfo. lowMemory );
  8. }
  9. }

By the way, the Android system also provides the Runtime class, but the information obtained by this class is the usage information of the Java Virtual Machine. The preceding section describes how to view Android information.

Related Article

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.