There are no file write and read methods in Android where SD is inserted

  • 2020-05-05 13:16:12
  • OfStack

One of the following situations occurs when Android is being developed You want the application to be downloaded to the root of the current application, not to
on the SD card The file can then be accessed at any time by that application or by another application, with permission to be read globally,

At this point, the local file output stream of the context can be used to write the file to
Be careful to give the file writable and readable permissions, otherwise an
error will be reported when the file is read FileOutputStream fos = context.openFileOutput(saveFileName,
Context.MODE_WORLD_WRITEABLE
| Context.MODE_WORLD_READABLE);
The read file can then be retrieved to the input stream
using context.openFileInput You can also use context.getFileStreamPath (name) to get an instance of File, which is especially useful if you want to download an Apk locally and open it.

Finally, note that the permission declaration is inserted in the configuration file.

Related articles: