廣場的改造目前支持GSON和XML內容格式類型這樣
GSON:
Gson gson = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.github.com")
.setConverter(new GsonConverter(gson))
.build();
GitHubService服務= restAdapter.create(GitHubService.class);
XML:
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.soundcloud.com")
.setConverter(new SimpleXMLConverter())
.build();
SoundCloudService service = restAdapter.create(SoundCloudService.class);
您正在處理的文件I/O類型,無論是你需要,你需要建立自己的SimpleBitmapConverter()或者乾脆用其他圖像載入庫像Koush ION
加載的圖像成的ImageView /位圖與Koush ION:
//這是「長」的方式來做到建立一個ImageView的請求..它允許你設置標題等。
Ion.with(context)
.load("http://example.com/image.png")
.withBitmap()
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.animateLoad(spinAnimation)
.animateIn(fadeInAnimation)
.intoImageView(imageView);
// but for brevity, use the ImageView specific builder...
Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.animateLoad(spinAnimation)
.animateIn(fadeInAnimation)
.load("http://example.com/image.png");
歡迎來到SO!在發佈問題前請閱讀http://stackoverflow.com/help/how-to-ask。 – 2014-10-01 11:19:20