Reputation: 314
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.
Upvotes: 5
Views: 12707
Reputation: 1369
what is this
reference to your activity, if yes then use:
this.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
Upvotes: 4