Android Question Error while sending attachment

Makumbi

Well-Known Member
Licensed User
iam getting this error when i try to send an attachment

B4X:
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 60 (Main)
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND_MULTIPLE typ=text/plain flg=0x20001 clip={text/plain U:content://b4a.example.provider/name/b4a.png ...} (has extras) }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2007)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
    at android.app.Activity.startActivityForResult(Activity.java:4586)
    at android.app.Activity.startActivityForResult(Activity.java:4544)
    at android.app.Activity.startActivity(Activity.java:4905)
    at android.app.Activity.startActivity(Activity.java:4873)
    at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:859)
    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.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:6597)
    at android.view.View.performClickInternal(View.java:6574)
    at android.view.View.access$3100(View.java:778)
    at android.view.View$PerformClick.run(View.java:25885)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

B4X:
Sub btnSendEmail_Click
    Dim FileName As String = "b4a.png"
    'copy the shared file to the shared folder
    File.Copy(File.DirAssets, FileName, Starter.Provider.SharedFolder, FileName)
    Dim email As Email
    email.To.Add("[email protected]")
    email.Subject = "subject"
    email.Attachments.Add(Starter.Provider.GetFileUri(FileName))
    email.Attachments.Add(Starter.Provider.GetFileUri(FileName)) 'second attachment
    Dim in As Intent = email.GetIntent
    in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
    StartActivity(in)
End Sub
 

Attachments

  • FileProvider.zip
    20.5 KB · Views: 157

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works fine here:

1586152059556.png


Are you testing it on a real device?

This error means that none of the installed apps were able to handle this intent.
 
Upvote 0
Top