나는 안드로이드 프로그래밍에 익숙하지 않습니다. 비트 맵을로드 할 때 문제가 있습니다.로드해야하는 비트 맵이 거의 92 개 있습니다. 하지만, 9 또는 10 비트 맵 후 응용 프로그램이 충돌은 .. 친절하게 여기 arraylist에서 거대한 양의 비트 맵을로드 할 때 내 응용 프로그램이 다운 됨
이 09-05 19시 49분 "OOM까지 1,805,056 무료 바이트 1천7백62킬로바이트으로 22,050,012 바이트 할당을 할당 할 수 없습니다"라는 오류 OutOfMemoryError를 던지고 도와 : 36.188 2615년부터 2615년까지/com.example.zeeshanahmedawan.yourworriestheirsolutions D/라이브러리에 의존 : --- 할당이 축소 비트 맵mPages = new ArrayList<Bitmap>();
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p1));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p2));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p3));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p4));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p5));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p6));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p7));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p8));
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.p9));
) LogCat을 사용하여 충돌과 관련된 Java 스택 추적을 검사하십시오. https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can - 해결 -이. – CommonsWare
Throwing OutOfMemoryError "OOM까지 1805056 프리 바이트 및 1762KB의 22050012 바이트 할당을 할당하지 못했습니다" 09-05 19 : 49 : 36.188 2615-2615/com.example.zeeshanahmedawan.yourworriestheirsolutions D/skia : --- 할당에 실패했습니다. 크기가 조정 된 비트 맵 @CommonsWare –
나는 잘못된 방향으로 가고 있다고 말하고 싶습니다. 팽창 된 비트 맵을 배열에 저장하면 불필요하게 많은 양의 메모리를 사용하게됩니다. 리소스 ID의 배열이나 목록을 유지하는 것만으로는 안됩니다. 즉 RecyclerView의 어댑터에 필요할 때 팽창됩니다. –