私は現在、私のアンドロイドプロジェクトに次のコードを持って:春AndroidのRestTemplateに探してSpring Android RestTemplateでリストを返すことはできますか?
protected List<Facility> doInBackground(String... params) {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(<SomeWebService>);
httpGet.addHeader("Accept", "application/json");
ResponseHandler<String> responseHandler = new BasicResponseHandler();
try{
Gson gson = new Gson();
Type collectionType = new TypeToken<Collection<Facility>>(){}.getType();
List<Facility> facilities= gson.fromJson(httpClient.execute(httpGet, responseHandler), collectionType);
return facilities;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
を、私はポイントをGoogleで検索すべて(この場合は施設に)リストにJSON配列をオンにする方法を参照してくださいません私はオブジェクトに。私は、Spring-Androidを使用すると上記のコードをよりシンプルに/クリーナーにすることができるかどうかを見ていましたが、私には何の示唆もしていません。どのように私は春のAndroidで上記のコードを書いて、具体的に私はテンプレートからリストを取得するでしょうか?