Im trying to write a class that saves images on disk.
Inside class I have method public static String saveToSdCard(Bitmap bitmap, String filename) and inside it I try to get a reference to files folder by using File path = new File(getFilesDir(), "myfolder");but I cant because IDE marks it red.
What am I doing wrong ?
You have to call it on the context.
Make sure you are in an Activity, or otherwise call it on a context instance, like getActivity().getFilesDir() or context.getFilesDir(), or even view.getContext().getFilesDir().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With