how to access getFilesDir() as an environment variable?
问题 I want to access getFilesDir() which is a context method. Is there any way to access it similarly to the way I access external-storage? Environment.getExternalStorageDirectory(); meaning as an environment variable? Maybe application static context? as I want to call this from a non-context class (same app service, but not an activity). 回答1: It's not possible. Context.getFilesDir() returns a path that is bound to your package and the Context is required to access the package name. Environment