Android - Read Only File System IOException

前端 未结 2 1133
时光说笑
时光说笑 2020-12-03 05:11

I am trying to write to a simple text file on the Android system. This is my code:

public void writeClassName() throws IOException{
    String FILENAME = \"c         


        
2条回答
  •  佛祖请我去吃肉
    2020-12-03 05:57

    Try to use the approach from this article in developer guide:

    String FILENAME = "hello_file";
    String string = "hello world!";
    
    FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
    fos.write(string.getBytes());
    fos.close();
    

提交回复
热议问题