본문 바로가기

Android

ListView에서 stackoverflowError이 떳을 경우....

FATAL EXCEPTION: main java.lang.StackOverflowError at android.text.Layout$Ellipsizer.getChars(Layout.java:2270) at android.text.TextUtils.getChars(TextUtils.java:70) at android.graphics.Paint.measureText(Paint.java:1071) at android.text.Styled.drawDirectionalRun(Styled.java:267) at android.text.Styled.measureText(Styled.java:430) at android.text.Layout.measureText(Layout.java:2065) at android.text.Layout.getLineMax(Layout.java:1020) at android.text.Layout.draw(Layout.java:612) at android.widget.TextView.onDraw(TextView.java:4314) at android.view.View.draw(View.java:6971) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480) at android.widget.ListView.dispatchDraw(ListView.java:3229) at android.view.View.draw(View.java:6974) at android.widget.AbsListView.draw(AbsListView.java:2588) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.widget.FrameLayout.draw(FrameLayout.java:357) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.widget.FrameLayout.draw(FrameLayout.java:357) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.ViewGroup.drawChild(ViewGroup.java:1708) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.widget.FrameLayout.draw(FrameLayout.java:357) at android.view.ViewGroup.drawChild(ViewGroup.java:1710) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1437) at android.view.View.draw(View.java:6974) at android.widget.FrameLayout.draw(FrameLayout.java:357) at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1929) at android.view.ViewRoot.draw(ViewRoot.java:1590) at android.view.ViewRoot.performTraversals(ViewRoot.java:1290) at android.view.ViewRoot.handleMessage(ViewRoot.java:1939) at android.os.Handler.dispatchMessage(Handler.java:99) at androi

커스텀 리스트 뷰를 썻을 때 이런 에러가 뜨는 것을 볼 수있다.

무언가 계속 무한루프가 돌고있지만 사실은 listview에 쓰인 row.xml가 원인이다.

row로 쓰인 xml이 구조가 복잡하면 복잡할수록 더 안좋다는 사실.(LinearLayout 안에 LinearLayout넣고 또 LinearLayout넣고... 이러면 잘난다...)

그렇기때문에 되도록이면 row에 쓰이는 xml은 간단하게 만드는게 좋다.