This is because in the static method you do not have a class object, and getFilesDir is not a static method, which means that it will be available only through the object of the Context class.
, , , .
:
static YourContextClass obj;
static void method(){
File myFile = new File (obj.getFilesDir(), filename );
}
onCreateMethod()
obj = this;
-
static void method(YourContextClass obj){
File myFile = new File (obj.getFilesDir(), filename );
}