Created
September 30, 2012 15:14
-
-
Save yachi/3807097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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