Что может быть причиной этой ошибки: java.lang.OutOfMemoryError: Не удалось не выделить распределение 10111384 байт с 1305618 свободных байтов и 1275KB до ООМAndroid пожары OutOfMemoryError при загрузке изображения из ASMX веб-службы
происходит ошибка в эта линия:
Bitmap bmp = BitmapFactory.decodeByteArray(currentTour.getTourImage(),0,currentTour.getTourImage().length);
Мой ListView адаптер Вид:
public View getView(int position, View view, ViewGroup parent) {
if (view == null)
view = getLayoutInflater().inflate(R.layout.tour_item, parent, false);
if (position % 2 == 1) {
view.setBackgroundColor(Color.rgb(189, 230, 247));
} else {
view.setBackgroundColor(Color.WHITE);
}
TourAnounceRow currentTour = tourAnounceList.get(position);
if (currentTour != null) {
TextView tourName = (TextView) view.findViewById(R.id.lblTourName);
tourName.setText(currentTour.getTourName());
TextView place = (TextView) view.findViewById(R.id.lblPlace);
place.setText(currentTour.getPlace());
RatingBar tourStarCount = (RatingBar) view.findViewById(R.id.ratingBarTourStarCount);
tourStarCount.setRating(Float.parseFloat(String.valueOf(currentTour.getHotelStarsCount())));
TextView adultCount = (TextView) view.findViewById(R.id.lblAdultCount);
adultCount.setText(String.valueOf(currentTour.getAdultCount()));
TextView childrenCount = (TextView) view.findViewById(R.id.lblChildCount);
childrenCount.setText(String.valueOf(currentTour.getChildrenCount()));
TextView mealCount = (TextView) view.findViewById(R.id.lblMealCount);
mealCount.setText(String.valueOf(currentTour.getDailyMealCount()));
TextView price = (TextView) view.findViewById(R.id.lblPrice);
price.setText(String.valueOf(currentTour.getPrice()));
ImageView ivTourImage = (ImageView) view.findViewById(R.id.ivTourImage);
ivTourImage.setScaleType(ImageView.ScaleType.FIT_XY);
Bitmap bmp = BitmapFactory.decodeByteArray(currentTour.getTourImage(), 0,currentTour.getTourImage().length);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.WEBP, 10, stream);
ivTourImage.setImageBitmap(bmp);
}
return view;
}
Спасибо f3rn4nd000 за помощью. –
You'r welcome;) – f3rn4nd000
Я изменил свой код Bitmap bmp = BitmapFactory.decodeByteArray (currentTour.getTourImage(), 0, currentTour.getTourImage(). Length); ivTourImage.setImageBitmap (Bitmap.createScaledBitmap (bmp, 120,120, false)); но моя ошибка также была запущена –