Skip to content

Instantly share code, notes, and snippets.

@mbarcia
Created November 25, 2014 22:07
Show Gist options
  • Save mbarcia/32447bc55d03cce783a5 to your computer and use it in GitHub Desktop.
Save mbarcia/32447bc55d03cce783a5 to your computer and use it in GitHub Desktop.
postImage() you can add to your MyApi class. Read more about a multipart request at http://stackoverflow.com/a/9082243
public Request<?> postImage(
String token,
long l,
File imageFile,
Listener<String> listener,
ErrorListener errorListener) {
String url = "http://yoururl.com/post-image";
PhotoMultipartRequest<String> req = new PhotoMultipartRequest<String>(
url,
errorListener,
listener,
imageFile);
req.setRetryPolicy(new DefaultRetryPolicy(
POST_TIMEOUT,
2,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
return mQueue.add(req);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment