How to Download File Using DownloadManager in API 29 or Android Q?

> It works well when i run it on any device below API 29(My testing device was Nexus 5X ,ApI 28 emulator). But when I run it on Nexus 5X ,API 29 The app gets crashed. Here is the Logs:

2019-09-24 20:51:46.354 11322-11344/? E/DatabaseUtils: Writing exception to parcel java.lang.IllegalStateException: Not one of standard directories: /storage/emulated/0/Android/data/com.blz.prisoner.downloadmanager/files/Pictures/NewFile at com.android.providers.downloads.DownloadProvider.call(DownloadProvider.java:651) at android.content.ContentProvider.call(ContentProvider.java:2152) at android.content.ContentProvider$Transport.call(ContentProvider.java:477) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:277) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) 

2019-09-24 20:51:46.355 15023-15023/com.blz.prisoner.downloadmanager D/AndroidRuntime: Shutting down VM

--------- beginning of crash 2019-09-24 20:51:46.360 15023-15023/com.blz.prisoner.downloadmanager E/AndroidRuntime: FATAL EXCEPTION: main Process: com.blz.prisoner.downloadmanager, PID: 15023 java.lang.IllegalStateException: Not one of standard directories: /storage/emulated/0/Android/data/com.blz.prisoner.downloadmanager/files/Pictures/NewFile at android.os.Parcel.createException(Parcel.java:2079) at android.os.Parcel.readException(Parcel.java:2039) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140) at android.content.ContentProviderProxy.call(ContentProviderNative.java:658) at android.content.ContentProviderClient.call(ContentProviderClient.java:558) at android.content.ContentProviderClient.call(ContentProviderClient.java:546) at android.app.DownloadManager$Request.setDestinationInExternalPublicDir(DownloadManager.java:567) at com.blz.prisoner.downloadmanager.MainActivity.DownloadImage(MainActivity.java:206) at com.blz.prisoner.downloadmanager.MainActivity.access$200(MainActivity.java:29) at com.blz.prisoner.downloadmanager.MainActivity$1.onClick(MainActivity.java:60) at android.view.View.performClick(View.java:7140) at android.view.View.performClickInternal(View.java:7117) at android.view.View.access$3500(View.java:801) at android.view.View$PerformClick.run(View.java:27351) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

I think the problem is on line " request.setDestinationInExternalPublicDir(getExternalFilesDir(Environment.DIRECTORY_PICTURES) + "/NewFile","sample2.jpg");" in DownloadImage(Uri uri) function. How to solve the problem?? Another Problem is when I run the app on the device below API 29 it runs well but when I click on notification after completing the download it doesn't open the image on gallery/on the folder it was saved.