Not Able To Attach Excel File From Assets Folder
I am not able to attach an excel file from assets folder using email intent in android. Can anyone please suggest what is wrong in the below code. The email opens but a message com
Solution 1:
First, assets/test.xlsx
is not a file on the Android device. It is an asset, packaged in your APK. Hence, new File("assets/test.xlsx")
.
Second, even if there was a file at that path, third-party email apps cannot read it.
Either:
Copy the file to external storage, then create a
Uri
to that and use it in yourIntent
, orCopy the file to internal storage and use
FileProvider
to serve it, orUse my
StreamProvider
to serve it straight from assets
Post a Comment for "Not Able To Attach Excel File From Assets Folder"