내 응용 프로그램에서 심각한 성능 문제가 발생했습니다. 비트 맵을로드하면 메모리가 많이 차지하는 것처럼 보입니다.여러 개의 고품질 비트 맵로드 및 크기 조정
모든 안드로이드 장치의 비트 맵 크기를 포함하는 드로어 블 폴더가 있습니다.이 비트 맵은 고품질입니다. 기본적으로 각 비트 맵을 따라 가고 크기에 따라 장치에 대해 새로운 비트 맵을 만듭니다. (올바른 방향과 모든 장치를 지원하기 때문에이 방법을 사용하기로 결정했습니다.) 그것은 작동하지만 많은 메모리를 사용하고로드하는 데 시간이 걸립니다. 누구나 다음 코드에 대한 제안을 할 수 있습니까?
public Bitmap getBitmapSized(String name, int percentage, int screen_dimention, int frames, int rows, Object params)
{
if(name != "null")
{
_tempInt = _context.getResources().getIdentifier(name, "drawable", _context.getPackageName());
_tempBitmap = (BitmapFactory.decodeResource(_context.getResources(), _tempInt, _BM_options_temp));
}
else
{
_tempBitmap = (Bitmap) params;
}
_bmWidth = _tempBitmap.getWidth()/frames;
_bmHeight = _tempBitmap.getHeight()/rows;
_newWidth = (screen_dimention/100.0f) * percentage;
_newHeight = (_newWidth/_bmWidth) * _bmHeight;
//Round up to closet factor of total frames (Stops juddering within animation)
_newWidth = _newWidth * frames;
//Output the created item
/*
Log.w(name, "Item");
Log.w(Integer.toString((int)_newWidth), "new width");
Log.w(Integer.toString((int)_newHeight), "new height");
*/
//Create new item and recycle bitmap
Bitmap newBitmap = Bitmap.createScaledBitmap(_tempBitmap, (int)_newWidth, (int)_newHeight, false);
_tempBitmap.recycle();
return newBitmap;
}
이것을 읽었으며 앞으로 비트 맵을로드하는 유일한 방법 인 것 같습니다. –