After seeing a twitter post asking about HTTP MultiPart on Android which linked to a Google Groups thread which recommended a solution which required the inclusion of multiple libraries, I thought it might be worth sharing a method I’ve used in the past which can be used reasonably easily and doesn’t require tens of kilobytes of unused library functions to be added to your app.
First off you’ll need the AOSP source which can be obtained from an unofficial mirror in the absence of the primary official repository at kernel.org.
Once you’ve checked out the source from frameworks_base you can “re-use” the implementation available internally in Android which can be found in;
The instructions on how to use it are in the comments of MultipartEntity.java
This is internal Android code which comes with all the warnings about “there be dragons”, but, if you take the entire package and rename it to something in your own namespace, you should be safe from name space clashes and the like (I haven’t heard of any issues in the projects I’ve used it in).
Feel free to discuss this solution below (and don’t forget to ensure you comply with the license the code is under :))….