本文介绍了java.lang.StackOverflowError在ANDROID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到java.lang.StackOverflowError当我打电话的活动从的ActivityGroup。

以下是code:

 意向书I =新意图(PermissionsScreen.this,DownloadActivity.class);
replaceContentView(Activity10我);
公共无效replaceContentView(字符串ID,意图newIntent){
视图视图= getLocalActivityManager()startActivity(ID,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
this.setContentView(视图);
    }

当我在地方DownloadActivity.class的调用不同的活动我没有得到java.lang.StackOverflowError,如图

 意向书I =新意图(PermissionsScreen.this,PaymentScreen.class);
replaceContentView(Activity10我);

在第一观察PaymentScreen和DownloadActivity之间的差别在于,PaymentScreen是一个简单的活动。而DownloadActivity使用的AsyncTask下载文件。

是什么原因导致的StackOverflowError当我发起一个活动发生在另一种情况下不会发生?

我无法找到同样的原因很明显。

任何帮助是AP preciated。

  12月5日至15日:38:11.906:WARN / audio_hw_primary(135):select_output_device E = 0,H = 0,S = 2,B = 0
12月5日至一十五日:38:11.953:信息/ dalvikvm(6119):主题ID = 1:调用Landroid /文本/一个TextLine堆栈溢出; .handleText:FLIIIIZLFIIILZ
12月5日至一十五日:38:11.953:信息/ dalvikvm(6119):方法需要164 + 20 + 40 = 224个字节,FP是0x56c9b36c(108左右)
12月5日至一十五日:38:11.953:信息/ dalvikvm(6119):扩展堆栈端(0x56c9b300到0x56c9b000)
12月5日至一十五日:38:11.953:信息/ dalvikvm(6119):缩小栈(以0x56c9b300,当前帧是0x56c9b88c)
12月5日至一十五日:38:11.953:DEBUG / AndroidRuntime(6119):关闭VM
12月5日至一十五日:38:11.953:WARN / dalvikvm(6119):主题ID = 1:螺纹未捕获的异常(组= 0x40b1a1f8)退出
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):致命异常:主要
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):java.lang.StackOverflowError
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.TextLine.handleRun(TextLine.java:1021)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.TextLine.measureRun(TextLine.java:470)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.TextLine.measure(TextLine.java:315)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.TextLine.metrics(TextLine.java:289)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.Layout.getLineExtent(Layout.java:949)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.Layout.draw(Layout.java:409)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.text.BoringLayout.draw(BoringLayout.java:400)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.widget.TextView.onDraw(TextView.java:5004)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.draw(View.java:10880)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10319)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.draw(View.java:10883)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.widget.FrameLayout.draw(FrameLayout.java:450)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.widget.ScrollView.draw(ScrollView.java:1655)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10319)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.draw(View.java:10883)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10319)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10317)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.draw(View.java:10883)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.widget.FrameLayout.draw(FrameLayout.java:450)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.View.getDisplayList(View.java:10319)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):在android.view.ViewGroup.drawChild(ViewGroup.java:2862)
12月5日至一十五日:38:11.968:ERROR / AndroidRuntime(6119):
12月5日至一十五日:38:12.046:警告/ ActivityManager(261):强制完成活动com.nykkos.personalize / .profiler.Personalization
12月5日至一十五日:38:12.109:信息/窗口管理器(261):createSurface窗口{424e87a0暂停= FALSE}:DRAW现等待
12月5日至一十五日:38:12.117:DEBUG / dalvikvm(6119):GC_CONCURRENT释放1265K,17457K自由/ 18823K 8%,暂停8毫秒14毫秒+

下面给出是活动的布局:

 <?XML版本=1.0编码=UTF-8&GT?;

 <的LinearLayout
    机器人:ID =@ + ID / bottom_layout_downloading
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignParentBottom =真
    机器人:方向=垂直>    <的TextView
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:文字=@字符串/ TOTAL_PROGRESS/>    <进度
        机器人:ID =@ + ID / all_download_downloading
        风格=机器人:ATTR / progressBarStyleHorizo​​ntal
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_marginTop =10dp
        机器人:indeterminateOnly =假
        安卓了maxHeight =10dip
        安卓了minHeight =10dip/>    <的LinearLayout
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=横向
        机器人:填充=10dp>        <按钮
            机器人:ID =@ + ID / exit_btn_downloading
            机器人:layout_width =0dip
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_weight =1
            机器人:文字=@字符串/ exit_back/>        <按钮
            机器人:ID =@ + ID / download_btn_downloading
            机器人:layout_width =0dip
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_weight =1
            机器人:文字=@字符串/ start_download/>
    < / LinearLayout中>
< / LinearLayout中>


    

 < / LinearLayout中>
  < /滚动型>
  < / RelativeLayout的>

以下给出我在DownloadActivity使用适配器的布局

 <?XML版本=1.0编码=UTF-8&GT?;
 <的TableRow的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=垂直><的LinearLayout
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =match_parent
    机器人:layout_marginLeft =10dp
    机器人:layout_marginRight =10dp
    机器人:方向=垂直>    <的TextView
        机器人:ID =@ + ID / textViewContent
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文字颜色=@色/蓝
        机器人:TEXTSIZE =22sp/>    <的TextView
        机器人:ID =@ + ID /文本链接
        机器人:layout_width =300dp
        机器人:layout_height =WRAP_CONTENT
        机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceLarge?    <进度
        机器人:ID =@ + ID /进度
        风格=机器人:ATTR / progressBarStyleHorizo​​ntal
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =12dp
        机器人:progressDrawable =@绘制/ green_progress_color/>    <的TextView
        机器人:ID =@ + ID / textPercent
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =右
        机器人:重力=右
        机器人:文字=0%
        机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceLarge?
< / LinearLayout中>< /&的TableRow GT;


解决方案

根据您的堆栈跟踪,你有尝试画本身就是一个巨大的嵌套视图层次。

无论它是一个疯狂的深层次,或者你编程建立\\充气内子视图您的的ViewGroup ,并最终创建一个递归视图遏制。

无论哪种方式,它似乎并不c您贴出相关$ C $,但有问题的活动的实际UI内容。

如果你没有找到在活动布局问题(这似乎pretty从堆栈跟踪明显),请发表您的布局XML或者在你的问题你的布局code。

I get java.lang.StackOverflowError when I call an activity from an activitygroup.

Following is the code:

Intent i = new Intent(PermissionsScreen.this,DownloadActivity.class);
replaceContentView("Activity10",i);
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView();
this.setContentView(view);
    }

I do not get the java.lang.StackOverflowError when I call a different activity in place of DownloadActivity.class, as shown

Intent i = new Intent(PermissionsScreen.this,PaymentScreen.class);
replaceContentView("Activity10",i);

The difference between PaymentScreen and DownloadActivity in first observation is that, PaymentScreen is a simple activity. Whereas DownloadActivity uses asynctask for downloading files.

What causes StackOverflowError to occur when I launch one activity and does not occur in another case?

I am unable to find any obvious reasons for the same.

Any help is appreciated.

05-15 12:38:11.906: WARN/audio_hw_primary(135): select_output_device e=0, h=0, s=2, b=0
05-15 12:38:11.953: INFO/dalvikvm(6119): threadid=1: stack overflow on call to Landroid/text/TextLine;.handleText:FLIIIIZLFIIILZ
05-15 12:38:11.953: INFO/dalvikvm(6119):   method requires 164+20+40=224 bytes, fp is 0x56c9b36c (108 left)
05-15 12:38:11.953: INFO/dalvikvm(6119):   expanding stack end (0x56c9b300 to 0x56c9b000)
05-15 12:38:11.953: INFO/dalvikvm(6119): Shrank stack (to 0x56c9b300, curFrame is 0x56c9b88c)
05-15 12:38:11.953: DEBUG/AndroidRuntime(6119): Shutting down VM
05-15 12:38:11.953: WARN/dalvikvm(6119): threadid=1: thread exiting with uncaught exception (group=0x40b1a1f8)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119): FATAL EXCEPTION: main
05-15 12:38:11.968: ERROR/AndroidRuntime(6119): java.lang.StackOverflowError
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.TextLine.handleRun(TextLine.java:1021)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.TextLine.measureRun(TextLine.java:470)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.TextLine.measure(TextLine.java:315)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.TextLine.metrics(TextLine.java:289)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.Layout.getLineExtent(Layout.java:949)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.Layout.draw(Layout.java:409)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.text.BoringLayout.draw(BoringLayout.java:400)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.widget.TextView.onDraw(TextView.java:5004)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.draw(View.java:10880)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10319)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.draw(View.java:10883)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.widget.FrameLayout.draw(FrameLayout.java:450)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.widget.ScrollView.draw(ScrollView.java:1655)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10319)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.draw(View.java:10883)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10319)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10317)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2495)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.draw(View.java:10883)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.widget.FrameLayout.draw(FrameLayout.java:450)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.View.getDisplayList(View.java:10319)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):     at android.view.ViewGroup.drawChild(ViewGroup.java:2862)
05-15 12:38:11.968: ERROR/AndroidRuntime(6119):
05-15 12:38:12.046: WARN/ActivityManager(261):   Force finishing activity com.nykkos.personalize/.profiler.Personalization
05-15 12:38:12.109: INFO/WindowManager(261): createSurface Window{424e87a0  paused=false}: DRAW NOW PENDING
05-15 12:38:12.117: DEBUG/dalvikvm(6119): GC_CONCURRENT freed 1265K, 8% free 17457K/18823K, paused 8ms+14ms

Given below is the layout of the activity:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/bottom_layout_downloading"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/total_progress" />

    <ProgressBar
        android:id="@+id/all_download_downloading"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:indeterminateOnly="false"
        android:maxHeight="10dip"
        android:minHeight="10dip" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="10dp" >

        <Button
            android:id="@+id/exit_btn_downloading"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/exit_back" />

        <Button
            android:id="@+id/download_btn_downloading"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/start_download" />
    </LinearLayout>
</LinearLayout>
  </LinearLayout>
  </ScrollView>
  </RelativeLayout>

Given below is the layout of the adapter which I use in DownloadActivity

    <?xml version="1.0" encoding="utf-8"?>
 <TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textViewContent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/blue"
        android:textSize="22sp" />

    <TextView
        android:id="@+id/textLink"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="12dp"
        android:progressDrawable="@drawable/green_progress_color" />

    <TextView
        android:id="@+id/textPercent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:gravity="right"
        android:text="0%"
        android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>

</TableRow>
解决方案

According to your stack trace, you have a huge nested view hierarchy that tries to draw itself.

Either it's an insanely deep hierarchy, or maybe you programatically build\inflate child views inside your ViewGroup, and end up creating a recursive view containment.

Either way, it doesn't seem related to the code you posted, but to the actual UI content of the problematic activity.

If you don't find the problem in the activity layout (which seems pretty obvious from that stack trace), please post your layout XML or your layout code in your question.

这篇关于java.lang.StackOverflowError在ANDROID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 06:05