正文

圖像存儲和元數(shù)據(jù)(14)

Android多媒體開發(fā)高級編程 作者:(美)艾佛瑞


//titleTextView.setText(cursor.getString(titleColumn));

titleTextView.setText(cursor.getString(displayColumn));

imageFilePath = cursor.getString(fileColumn);

bmp = getBitmap(imageFilePath);

imageButton.setImageBitmap(bmp);

}

);

}

下面是一個稱為getBitmap的方法,它封裝了圖像的縮放和加載功能。這么做是為了在顯示這些圖像時避免產生本章前面所討論的內存問題。

private Bitmap getBitmap(String imageFilePath) 

{

// 加載圖像的尺寸而不是圖像本身

BitmapFactory.Options bmpFactoryOptions = 

new BitmapFactory.Options();

bmpFactoryOptions.inJustDecodeBounds = true;

);


上一章目錄下一章

Copyright ? 讀書網 www.dappsexplained.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號 鄂公網安備 42010302001612號