4

Since google killed the perfectly fine method getExternalStoragePublicDirectory, I have to try to get getExternalFilesDir to work.

This is one of the things I've tried:

private Context context = this.getApplicationContext();
private static final String test = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);

error message:

Non-static field 'context' cannot be referenced from a static context

I am not allowed to make context a static field though.

theerrormagnet
  • 174
  • 2
  • 15

1 Answers1

3

what is this reference to your activity, if yes then use:

this.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
Krishna Sony
  • 1,286
  • 13
  • 27