首页 > 移动平台 > 详细

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

时间:2014-06-02 09:19:53      阅读:401      评论:0      收藏:0      [点我收藏+]
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取国家,语言,存储大小等

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!