我想在我的 android 应用程序上看到带有 textView 的“abc.txt”路径。我该怎么做?
OutputStreamWriter out = new OutputStreamWriter(openFileOutput("abc.txt", Context.MODE_WORLD_READABLE));
BufferedWriter bf = new BufferedWriter(out);
bf.write("hello world");
bf.close();
编辑:形状像路径; emulated/legancy/android/data/com.hayro.project1/files/abc.txt 或其他东西。
最佳答案
File f = new File("abc.txt");
OutputStreamWriter out = new OutputStreamWriter(openFileOutput("abc.txt", Context.MODE_WORLD_READABLE));
BufferedWriter bf = new BufferedWriter(out);
bf.write("hello world");
bf.close();
System.out.println(f.getAbsolutePath());
我仅以 System.out 为例。您只需使用 f.getAbsolutePath()
获取路径,然后将其分配给适当的变量。
关于java - 如何查看书面文本文件的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29798050/