简体   繁体   中英

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); But it says that openFileOutput is not a method.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM