Skip to content

Instantly share code, notes, and snippets.

@yachi
Created September 30, 2012 15:14
Show Gist options
  • Save yachi/3807097 to your computer and use it in GitHub Desktop.
Save yachi/3807097 to your computer and use it in GitHub Desktop.
package org.newsweb;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import org.springframework.web.client.RestTemplate;
import org.springframework.http.converter.StringHttpMessageConverter;
public class newsweb extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
String url = "http://hknewsweb.herokuapp.com/api/apple/sections";
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
String result = restTemplate.getForObject(url, String.class);
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(R.id.text);
tv.setText(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment