无法在内部存储中找到保存到文本文件的数据,如何将文件保存到内部存储android studio?

Cant find the saved data to text file in internal storage, How to save file in internal storage android studio?

我想在我的 android phone 上创建一个文本文件并向其中写入一些文本。
当我点击按钮时,它显示 saved to /data/user/0/com.example.savetotextfile/files/example.txt
但是我找不到这些文件夹。
大多数应用程序都在 Device storage > Android > data 中,但我自己创建的应用程序不在那里。
我缺少许可吗?
我不想写入 SD 卡。

public class MainActivity extends AppCompatActivity {

    private static final String FILE_NAME = "example.txt";

    EditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        editText = findViewById(R.id.editText);
    }

    public void save(View v) {
        String text = editText.getText().toString();
        FileOutputStream fos = null;

        try {
            fos = openFileOutput(FILE_NAME, MODE_PRIVATE);
            fos.write(text.getBytes());

            editText.getText().clear();
            Toast.makeText(this, "Saved to" + getFilesDir() + "/" + FILE_NAME, Toast.LENGTH_LONG).show();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

If you want to see file saved in internal storage you cannot just see through file manager. (Note your phone should be rooted if you want to see that directly)

按照以下步骤查看保存在内部存储器中的文件。

1) 将设备连接到您的 laptop/computer。

2) 打开 android 工作室。

3) 现在在 android studio 的右端你会看到这个选项设备文件管理器。

4) 双击数据文件夹,然后再次双击数据文件夹

5) 找到您的应用程序包名称 com.example.yourapp 并双击它。

6) 双击要查看内部存储文件的应用程序包名称下的文件文件夹。