Skip to content

Instantly share code, notes, and snippets.

@StlTenny
Created March 14, 2012 19:22
Show Gist options
  • Save StlTenny/2038823 to your computer and use it in GitHub Desktop.
Save StlTenny/2038823 to your computer and use it in GitHub Desktop.
Sample RestService Implementation Snippet
RestService restService;
restService = new RestService(mHandler, this, "http://10.0.2.2:3000/bars/");
restService.addParam("lat", "40764917"); //Add params to request
restService.addParam("lng", "-73983130");
restService.addParam("range", "10");
restService.addHeader("Content-Type","application/json");//Add headers to request
//Overridden handler to process incoming response.
private final Handler mHandler = new Handler(){
@Override
public void handleMessage(Message msg){
String response = (String) msg.obj;
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment