0
所以我正在制作一个显示捕获图像的应用程序。我首先将捕获的图像保存在String的静态ArrayList中(在下面的代码中:methods.locationPath),然后将这些字符串转换为位图并将它们保存在位图的ArrayList中(在下面的代码中:图像)。加载位图需要的时间太长
for (String path : methods.locationPath) {
Bitmap bitmap = BitmapFactory.decodeFile(path);
images.add(bitmap);
}
gr = (GridView) findViewById(R.id.grid);
GridAdapter gridAdapter = new GridAdapter(this, values,images);
gr.setAdapter(gridAdapter);
然而,这种方法花费的时间太长。有没有办法通过尽可能小的更改来使此循环更快?
谢谢
使用图像加载库,如毕加索或滑翔图像,根据需要异步加载的图像。 – CommonsWare