Reputation:
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);
But it says that openFileOutput is not a method.
Upvotes: 1
Views: 115
Reputation: 684
openFileOutput
is a method of Context
class https://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,%20int)
Activity
is a subclass of Context
.
So if you are trying to call this method in Activity
, it should be supported.
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)
Upvotes: 1