[英]Android write to internal storage issue
I've got an issue with writing to internal storage. 我在写入内部存储时遇到问题。 I have read a lot of tutorials, but everywhere is this:
FileOutputStream fOut = openFileOutput(FILENAME, Context.MODE_PRIVATE);
我已经阅读了很多教程,但是到处都是:
FileOutputStream fOut = openFileOutput(FILENAME, Context.MODE_PRIVATE);
But it says that openFileOutput is not a method. 但是它说openFileOutput不是方法。
openFileOutput
is a method of Context
class https://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,%20int) openFileOutput
是Context
类https://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,%20int)的方法
Activity
is a subclass of Context
. Activity
是Context
的子类。 So if you are trying to call this method in Activity
, it should be supported. 因此,如果您尝试在
Activity
调用此方法,则应支持它。 If you trying to call it in some custom class, you should pass to it some instance of Context
class or subclass (for example Activity
instance) 如果尝试在某个自定义类中调用它,则应将一些
Context
类或子类的实例(例如Activity
实例)传递给它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.