While we are attaching any folder/file to mail or other attachment so we really need to attach folder with more than one sub folder. So we need to compress it so called zipping . It necessary in Mobile OS as in Windows. So for this android provide ZipOutPutStream and ZipEntry. ZipOutPutStream read complete folder and then ZipEntry zip all the file inside folder to a new compress folder. Zipping File is very easy.If you want dynamically select which file/folder to zipped then see this
In constructor we have two string parameter.first pass array of file inside a folder .Then file path to which zipped folder will save if it is not present then this code will create new zip folder.