我为我的播客应用程序编写了一个 rss 解析器。如果我用不同的播客解析 rss 提要并在 a 中显示结果,ListView
我的解析器解析整个提要大约需要 1-2 秒。
但是,如果我想在ListView
我BitmapFactory
的ImageView
.
不幸的是,这将我的执行时间从 1-2 秒延长到了 8-10 秒。
这就是我抓取缩略图的方式。有没有更好(更快)的方法来实现我想做的事情,如果有,我该如何实现?
提前致谢。
...
else if (name.equalsIgnoreCase(THUMBNAIL)) {
HttpGet get = new HttpGet(parser.nextText());
if (get != null && get.getURI().toString().length()>1) {
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = response.getEntity();
if (entity != null) {
byte[] bb = EntityUtils.toByteArray(entity);
currentItem.setBitmap(BitmapFactory.decodeByteArray(bb, 0, bb.length));
}
}
}