【发布时间】:2011-08-31 05:21:50
【问题描述】:
我创建了一个GalleryView 和ImageView,当在图库中单击一个项目时,它会显示更大的图像。我已经使用下面的代码来实现ImageAdapter:
public ImageAdapter(Context c)
{
context = c;
TypedArray a = obtainStyledAttributes(R.styleable.gallery1);
itemBackground = a.getResourceId(R.styleable.gallery1_android_galleryItemBackground, 0);
a.recycle();
}
当我删除声明 a.recycle() 时,没有任何变化,并且应用程序像以前一样正常运行,但是在我读到的所有地方都必须回收 typedArray。当我的应用程序运行方式没有变化时,recycle() 方法的用途是什么?
【问题讨论】:
标签: android