android.os.SystemProperties和android.os.Environment
2017-03-14 20:50
836 查看
android.os.SystemProperties介绍
public class SystemProperties{
public static String get(String key){}
public static String get(String key,String def){}
public static int getInt(String key,int def){}
public static long getLong(String key,long def){}
public static boolean getBoolean(String key,boolean def){}
public static void set(String key,String val){}
}
android.os.Environment介绍
其实Android Environment.getExternalStorageDirectory() 获取的 SD卡和手机本身带的存储 ;这两个存储都是外部储存,真正的内部储存位置是data/data/包名,所以用了这个会出现还是存到了手机自带存储上,而不是SD卡上
主要方法:
getRootDierctory()//获取根目录
getDataDirectory()//获取data目录
getExternalStorageDirectory()//获取sd卡目录
getDownloadCacheDirectory()//获取下载文件的缓存目录
getExternalStorageState()//sdcard的状态有:removed,unmounted,checking,nofs,mounted,mounted_ro,shared,unmountable,bad_removal
public class SystemProperties{
public static String get(String key){}
public static String get(String key,String def){}
public static int getInt(String key,int def){}
public static long getLong(String key,long def){}
public static boolean getBoolean(String key,boolean def){}
public static void set(String key,String val){}
}
android.os.Environment介绍
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ Toast.makeText(context,”not found SDCard”,Toast.LENGTH_LONG).show(); }else{ try{ File file=new File(Evironment.getExternalStorageDirectory(),”/text.txt”); FileOutputStream fos=new FileOutputStream(file); fos.write(content.getBytes()); fos.flush(); fos.close(); }catch(Exception e){ e.printStackTrace(); } }
其实Android Environment.getExternalStorageDirectory() 获取的 SD卡和手机本身带的存储 ;这两个存储都是外部储存,真正的内部储存位置是data/data/包名,所以用了这个会出现还是存到了手机自带存储上,而不是SD卡上
主要方法:
getRootDierctory()//获取根目录
getDataDirectory()//获取data目录
getExternalStorageDirectory()//获取sd卡目录
getDownloadCacheDirectory()//获取下载文件的缓存目录
getExternalStorageState()//sdcard的状态有:removed,unmounted,checking,nofs,mounted,mounted_ro,shared,unmountable,bad_removal
相关文章推荐
- 如何使用android.os.SystemProperties
- 关于android.os.SystemProperties的使用
- 如何使用android.os.SystemProperties
- android.os.SystemProperties反射帮助类
- 如何使用android.os.SystemProperties的方法
- 如何使用android.os.SystemProperties的方法
- 如何使用android.os.SystemProperties的方法
- 如何使用android.os.SystemProperties的方法
- 无法找到android.os.SystemProperties解决办法
- Error:(10, 18) 错误: 找不到符号 符号: 类 SystemProperties 位置: 程序包 android.os
- 如何使用android.os.SystemProperties的方法
- 如何使用android.os.SystemProperties的方法
- can t find dynamically referenced class android os systemproperties
- 如何使用android.os.SystemProperties
- 如何使用android.os.SystemProperties
- Android/System Properties
- 给android添加系统属性:Settings.system和SystemProperties
- Android 的系统属性(SystemProperties)设置分析
- Android 的系统属性(SystemProperties)设置分析
- Android 系统属性 SystemProperties 分析