As I posted a question a few days ago, I realized thet the stock eMail app couldn't send multiple files in attachment: https://stackoverflow.com/questions/5773006/sending-email-with-multiple-attachement-fail-with-default-email-android-app-but
Unfortunately, I got no answer on it, so need to find a workaround.
The user has to select in a list some pdf and send them by email with stock app. As the multiple attachment fail, I will create a zip file with all the requested files and sent this unique file.
So, hoz can I make an archive with some files on SDCard?
What I currently found is this: http://developer.android.com/reference/java/util/zip/ZipFile.html
public ZipFile (File file)
Since: API Level 1 Constructs a new ZipFile with the specified file.
But I don't understand how to use this with multiple files.
Thank a lot,
I modified the code from the static link answer into a static class, but this works great for me:
ZipFile
is a shortcut for the one file case. If you want to do multiple files, you need to work with aZipOutputStream
- just one click away from the javadoc page you quoted.And that javadoc also has an example on how to zip up multiple files.