在Android studio 里面想要写入文本内容怎么做

在 AndroidManifest.xml 文件中添加写入外部存储的权限。如果是 Android 6.0(API 级别 23)及以上的系统,还需要在运行时请求权限。



在 MainActivity 的 writeToFile 方法里调用 FileHelper 类:
private void writeToFile(String content) {
FileHelper.writeToInternalStorage(this, content, "example.txt");
}

posted @ 2025-03-22 17:15  lalalandla  阅读(15)  评论(0)    收藏  举报