For your first doubt:
Retrofit no have feature to manager image as Volley
and UIL has. The same company that developer Retrofit too have a nice lib to manager images called Picasso.
For your second doubt:
Headers that need to be added to every request can be specified using
a RequestInterceptor. The following code creates a RequestInterceptor
that will add a User-Agent header to every request.
for instance:
I developed a client to Parse.com and to all request I need set my keys in the header: see here Android-Retrofit-Example
public class RestClient {
private static RestClient mRestClient = null;
private static RestAdapter restAdapter;
private static RequestInterceptor requestInterceptor;
public static RestClient getInstance(){
if(mRestClient == null ){
mRestClient = new RestClient();
setup();
}
return mRestClient;
}
private static void setup(){
requestInterceptor = new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("X-Parse-Application-Id", "");
request.addHeader("X-Parse-REST-API-Key", "");
}
};
restAdapter = new RestAdapter.Builder()
.setEndpoint(" https://api.parse.com/1/")
.setLogLevel(RestAdapter.LogLevel.FULL)
.setRequestInterceptor(requestInterceptor)
.build();
}
public RestAdapter getRestAdapter(){
return restAdapter;
}
}
The last :
JSON CONVERSION
Retrofit uses Gson by default to convert HTTP bodies to and from JSON.
If you want to specify behavior that is different from Gson's defaults
(e.g. naming policies, date formats, custom types), provide a new Gson
instance with your desired behavior when building a RestAdapter. Refer
to the Gson documentation for more details on customization.
To get this :
{
results: [3]
{
createdAt: "2015-03-07T20:43:44.107Z"
objectId: "osCJ8PI65r"
updatedAt: "2015-03-08T00:45:37.539Z"
username: "Test 2"
},
{
createdAt: "2015-03-07T21:42:38.591Z"
objectId: "tkIi6Ll1Os"
updatedAt: "2015-03-07T21:42:38.591Z"
username: "Test 2"
},
{
createdAt: "2015-03-08T01:13:21.188Z"
objectId: "Cz0HqiYpwl"
updatedAt: "2015-03-08T04:21:18.069Z"
username: "Test 3"
}
}
Pojo :
public class User {
private String objectId;
private String username;
private String createdAt;
private String updatedAt;
//gerate getters and setters
}
public class WrappeUser {
@SerializedName(value="results")
List<User> results;
public List<User> getResults() {
return results;
}
public void setResults(List<User> results) {
this.results = results;
}
}