0
FileChannel src = new FileInputStream(source).getChannel();
FileChannel dst = new FileOutputStream(destination).getChannel();
dst.transferFrom(src, 0, src.size());  

src path is --> /storage/emulated/0/Pictures/IMG_20210630_182546.jpg

this is destination folder --> /storage/emulated/0/Android/data/com.tp.qa/files/temp

destination image name --> /gallery1625059659.jpg

Is there some problem in copying file from the above source?

Abraham Mathew
  • 2,029
  • 3
  • 21
  • 42

1 Answers1

1

In android 11 directly accessing storage is not Allowed. Here is the documentation how to use scoped permission in Android 11. You can try out this solution. In my case this worked.

Noban Hasan
  • 593
  • 1
  • 7
  • 21