代碼如圖,我想用gallery顯示bitmap出來,可是顯示的圖片都是一樣的,為什麼呢,如果說是bitmap內存沒釋放,我用recyle方法時候程序會閃退。求解答
public void GetBMP(){
LinearLayout contentLayout;
contentLayout = (LinearLayout) findViewById(R.id.test);
contentLayout.setDrawingCacheEnabled(true);
contentLayout.measure(
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
contentLayout.layout(0, 0, contentLayout.getMeasuredWidth(),
contentLayout.getMeasuredHeight());
contentLayout.buildDrawingCache();
bitmap= contentLayout.getDrawingCache();
}