Wednesday, December 25, 2013

Spring for Android

                       Spring for Android




add the below code in you gradle file in android studio 
-----
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-auth:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
}
add this in your activity
The following example illustrates how to search Google:

"services/search/web?v=1.0&q={query}";

// Create a new RestTemplate instance
RestTemplate restTemplate = new RestTemplate();

// Add the String message converter
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

// Make the HTTP GET request, marshaling the response to a String

String result = restTemplate.getForObject(url, String.class, "Android");

No comments:

Post a Comment