I made this code:
I get this error:
Error occurred on line: 309 (CicloAttuale)
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/b4a.aldopanizzi.mobi/files/db/0987.db exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141)
at android.net.Uri.checkFileUriExposed(Uri.java:2391)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:967)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11812)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11797)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1722)
at android.app.Activity.startActivityForResult(Activity.java:5377)
at android.app.Activity.startActivityForResult(Activity.java:5335)
at android.app.Activity.startActivity(Activity.java:5721)
at android.app.Activity.startActivity(Activity.java:5674)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16222)
The error line is 21 in the code posted here.
What can I do?
Thanks
B4X:
Sub Button1_Click
Dim Mail As String
Dim CodUtente As String
SQL1.Initialize(DBDirName, DBFileName, True)
ResultSet1 = SQL1.ExecQuery("SELECT * FROM Impostazioni")
Do While ResultSet1.NextRow
CodUtente = ResultSet1.GetString("codice_utente")
Mail = ResultSet1.GetString("mail_insegnante")
Loop
SQL1.Close
Dim nomefile As String = CodUtente & ".db"
Dim nuovadir As String = rp.GetSafeDirDefaultExternal("db")
File.Copy(DBDirName, DBFileName, nuovadir, nomefile)
Dim email As Email
Dim subject As String = "Invio file: " & nomefile
email.To.Add(Mail)
email.Subject = subject
email.Body = "Invio automatico del file db utente: " & CodUtente
email.Attachments.Initialize
email.Attachments.Add(File.Combine(nuovadir, nomefile))
StartActivity(email.GetIntent)
End Sub
I get this error:
Error occurred on line: 309 (CicloAttuale)
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/b4a.aldopanizzi.mobi/files/db/0987.db exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141)
at android.net.Uri.checkFileUriExposed(Uri.java:2391)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:967)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11812)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11797)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1722)
at android.app.Activity.startActivityForResult(Activity.java:5377)
at android.app.Activity.startActivityForResult(Activity.java:5335)
at android.app.Activity.startActivity(Activity.java:5721)
at android.app.Activity.startActivity(Activity.java:5674)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16222)
The error line is 21 in the code posted here.
What can I do?
Thanks