Spring for Android Example
It helps to simplify the development of native Android applications. Spring for Android is a framework that is designed to provide components of the Spring family of projects for use in Android apps. Like all Spring projects, the real power of Spring for Android is found in how easily it can be extended.
Features
- A Rest Client for Android
- Auth support for accessing secure APIs
You can start using spring-android in your project as dependency management.
Example
Below is the example illustrates how to search Google:
// The connection URL
String url = "https://ajax.googleapis.com/ajax/" +
"services/search/web?v=1.0&q={query}";
// Create a new RestTemplate instance
RestTemplate restTemplate1 = new RestTemplate();
// Add the String message converter
restTemplate1.getMessageConverters().add(new StringHttpMessageConverter());
// Make the HTTP GET request, marshaling the response to a String
String strResult = restTemplate1.getForObject(url, String.class, "Android");
Recent Comments