getCacheDir()和getFilesDir()方法区别.
Activity提供了getCacheDir()和getFilesDir()方法:
getCacheDir()方法用于获取/data/data//cache目录getFilesDir()方法用于获取/data/data//files目录//==================================================将文件写入SD卡内:获取SDCard的状态:Environment.getExtemalStorageState()Environment.MEDIA_MOUNTED手机装有SDCard,并且可以进行读写获取SDCard的目录:Environment.getExtemalStorageDirectory()//=============================================File saveFile=new File("/sdcard/zhzhg.txt");或:File sdCardDir=new File("/sdcard");//获取SD卡目录File saveFile = new File(sdCardDir,"zhzhg.txt");FileOutputStream outStream = new FileOutputStream(saveFile);outStream.write("文件的读写".getBytes());outStream.close();