Skip to content

Instantly share code, notes, and snippets.

@mplacona
Created August 19, 2016 18:22
Show Gist options
  • Save mplacona/bc603a71883e47bdab052afed256d216 to your computer and use it in GitHub Desktop.
Save mplacona/bc603a71883e47bdab052afed256d216 to your computer and use it in GitHub Desktop.
MainActivity.java
Call post(String url, Callback callback) throws IOException{
RequestBody formBody = new FormBody.Builder()
.add("To", mTo.getText().toString())
.add("Body", mBody.getText().toString())
.build();
Request request = new Request.Builder()
.url(url)
.post(formBody)
.build();
Call response = mClient.newCall(request);
response.enqueue(callback);
return response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment