码迷,mamicode.com
首页 > 移动开发 > 详细

android取国家,语言,存储大小等

时间:2014-06-02 09:20:53      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:android   c   class   blog   code   java   

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
private static String newUUID() {
    return UUID.randomUUID().toString();
  }
 
  private static String getLocaleCountry() {
    return java.util.Locale.getDefault().getCountry();
  }
 
  private static String getLocaleLanguage() {
    return java.util.Locale.getDefault().getLanguage();
  }
 
  private static long getTimeZoneOffset(long time) {
    // TimeZone.getOffset() returns milliseconds. We want seconds.
    return java.util.TimeZone.getDefault().getOffset(time) / 1000;
  }
 
  private static String getTimeZoneName() {
    return java.util.TimeZone.getDefault().getDisplayName(
        false, java.util.TimeZone.SHORT, java.util.Locale.getDefault());
  }
 
  private static long getFreeDiskSpace() {
    android.os.StatFs s = new android.os.StatFs(
        android.os.Environment.getDataDirectory().getAbsolutePath());
    return (long)s.getAvailableBlocks() * (long)s.getBlockSize();
  }
 
  private static long getTotalDiskSpace() {
    android.os.StatFs s = new android.os.StatFs(
        android.os.Environment.getDataDirectory().getAbsolutePath());
    return (long)s.getBlockCount() * (long)s.getBlockSize();
  }
 
  private String getPhoneNumberCountryCode() {
    try  {
      android.telephony.TelephonyManager tm = (android.telephony.TelephonyManager)
          getSystemService(Context.TELEPHONY_SERVICE);
      try {
        return tm.getNetworkCountryIso();
      } catch (Exception e) {
        return tm.getSimCountryIso();
      }
    } catch (Exception e) {
      return java.util.Locale.getDefault().getCountry();
    }
  }

  

android取国家,语言,存储大小等,布布扣,bubuko.com

android取国家,语言,存储大小等

标签:android   c   class   blog   code   java   

原文地址:http://www.cnblogs.com/profession/p/3763511.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!