Advertisement

掌握 C++(四七二)项目中 Android 平台下的文件存储技术

阅读量:

1、存储路径为/data/user/0/com.flx.testfilestorage/files

复制代码
 try {

    
     //mode参数注意下,这里使用的Context.MODE_PRIVATE
    
     FileOutputStream fileOutputStream = new FileOutputStream(new File(externalFile, "aaaa.txt"),true);//在文件后添加
    
     String content="ssdfsdfd";
    
     fileOutputStream.write(content.getBytes());
    
     outputStream.write( "Use OutputStream Create file\n".getBytes() );
    
     outputStream.close();
    
 } catch (IOException e) {
    
     Log.d( TAG, "outputStream err:"+e.getMessage() );
    
 }
    
    
    
    

2、存储路径为/storage/emulated/0/Android/data/com.flx

全部评论 (0)

还没有任何评论哟~