StackOverFlowError on the TimePicker Widget

Put your problem here if it does not fit any of the other categories.

StackOverFlowError on the TimePicker Widget

Postby bAZtARd » Wed May 21, 2008 9:44 am

Hi all.
I need some help with the TimePicker Widget. I have a Screen with 2
Tabs. One one tab there is one or more TimePicker Widgets nested in a
LinearLayout nested in a LinearLayout nested in a LinearLayout nested
in a ScrollView :-)

The TimePicker(s) are generated like so:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.        private View createDateWidget(String displayname, String value) {
  2.  
  3.                 Context ctx = mCtx;
  4.  
  5.                 String[] datetime = value.split(" ");
  6.  
  7.                 Log.d(LOG_TAG,value);
  8.  
  9.                 String[] date = datetime[0].split("-");
  10.  
  11.                 String[] time = datetime[1].split(":");
  12.  
  13.  
  14.  
  15.                 LinearLayout layout = createLayout(displayname);
  16.  
  17.                 LinearLayout innerlayout = new LinearLayout(ctx);
  18.  
  19.                 innerlayout.setLayoutParams(PARAMS_FILL_WRAP);
  20.  
  21.                 innerlayout.setOrientation(LinearLayout.HORIZONTAL);
  22.  
  23.                 layout.addView(innerlayout);
  24.  
  25.  
  26.  
  27.                 int day = Integer.parseInt(date[2]);
  28.  
  29.                 int month = Integer.parseInt(date[1]);
  30.  
  31.                 int year = Integer.parseInt(date[0]);
  32.  
  33.                 Button pickDate = new Button(ctx);
  34.  
  35.                 pickDate.setLayoutParams(PARAMS_WRAP_WRAP);
  36.  
  37.                 pickDate.setText(date[2]+"."+date[1]+"."+date[0]);
  38.  
  39.                 final DatePickerDialog dpd = new DatePickerDialog(ctx, new
  40.  
  41. DatePicker.OnDateSetListener(){
  42.  
  43.                         public void dateSet(DatePicker arg0, int arg1, int arg2, int arg3)
  44.  
  45. {
  46.  
  47.                                 Log.d(LOG_TAG, "Date changed on "+arg0+":
  48.  
  49. "+arg1+"-"+arg2+"-"+arg3);
  50.  
  51.                         }
  52.  
  53.                 }, year, month,day, Calendar.MONDAY);
  54.  
  55.         pickDate.setOnClickListener(new View.OnClickListener() {
  56.  
  57.  
  58.  
  59.             public void onClick(View v) {
  60.  
  61.                 dpd.show();
  62.  
  63.             }
  64.  
  65.         });
  66.  
  67.  
  68.  
  69.                 TimePicker tp = new TimePicker(ctx, null, null);
  70.  
  71.                 tp.setIs24HourView(true);
  72.  
  73.                 tp.setCurrentHour(Integer.parseInt(time[0]));
  74.  
  75.                 tp.setCurrentMinute(Integer.parseInt(time[1]));
  76.  
  77.                 tp.setLayoutParams(PARAMS_WRAP_WRAP);
  78.  
  79.                 tp.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener(){
  80.  
  81.                         public void timeChanged(TimePicker arg0, int arg1, int arg2) {
  82.  
  83.                                 Log.d(LOG_TAG, "Time changed on "+arg0+": "+arg1+":"+arg2);
  84.  
  85.                         }
  86.  
  87.                 });
  88.  
  89.                 innerlayout.addView(pickDate);
  90.  
  91.                 innerlayout.addView(tp);
  92.  
  93.                 return layout;
  94.  
  95.         }
Parsed in 0.041 seconds, using GeSHi 1.0.8.4


So there is a Button that leads to a DatePickerDialog and a TimePicker
in one line. If i want to change the hour everything works fine. As
soon as I want to change the minutes (either via up-down-buttons or
via number keys) the system throws a StackOverflowError that looks
like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ERROR/AndroidRuntime(856): java.lang.StackOverflowError
  2.  
  3. ERROR/AndroidRuntime(856):     at
  4.  
  5. android.graphics.Canvas.drawText(Canvas.java:889)
  6.  
  7. ERROR/AndroidRuntime(856):     at android.text.Layout.draw(Layout.java:
  8.  
  9. 282)
  10.  
  11. ERROR/AndroidRuntime(856):     at
  12.  
  13. android.widget.TextView.onDraw(TextView.java:1875)
  14.  
  15. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  16.  
  17. 4574)
  18.  
  19. ERROR/AndroidRuntime(856):     at
  20.  
  21. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  22.  
  23. ERROR/AndroidRuntime(856):     at
  24.  
  25. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  26.  
  27. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  28.  
  29. 4550)
  30.  
  31. ERROR/AndroidRuntime(856):     at
  32.  
  33. android.widget.FrameLayout.draw(FrameLayout.java:208)
  34.  
  35. ERROR/AndroidRuntime(856):     at
  36.  
  37. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  38.  
  39. ERROR/AndroidRuntime(856):     at
  40.  
  41. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  42.  
  43. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  44.  
  45. 4550)
  46.  
  47. ERROR/AndroidRuntime(856):     at
  48.  
  49. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  50.  
  51. ERROR/AndroidRuntime(856):     at
  52.  
  53. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  54.  
  55. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  56.  
  57. 4550)
  58.  
  59. ERROR/AndroidRuntime(856):     at
  60.  
  61. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  62.  
  63. ERROR/AndroidRuntime(856):     at
  64.  
  65. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  66.  
  67. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  68.  
  69. 4550)
  70.  
  71. ERROR/AndroidRuntime(856):     at
  72.  
  73. android.widget.FrameLayout.draw(FrameLayout.java:208)
  74.  
  75. ERROR/AndroidRuntime(856):     at
  76.  
  77. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  78.  
  79. ERROR/AndroidRuntime(856):     at
  80.  
  81. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  82.  
  83. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  84.  
  85. 4550)
  86.  
  87. ERROR/AndroidRuntime(856):     at
  88.  
  89. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  90.  
  91. ERROR/AndroidRuntime(856):     at
  92.  
  93. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  94.  
  95. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  96.  
  97. 4550)
  98.  
  99. ERROR/AndroidRuntime(856):     at
  100.  
  101. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  102.  
  103. ERROR/AndroidRuntime(856):     at
  104.  
  105. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  106.  
  107. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  108.  
  109. 4550)
  110.  
  111. ERROR/AndroidRuntime(856):     at
  112.  
  113. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  114.  
  115. ERROR/AndroidRuntime(856):     at
  116.  
  117. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  118.  
  119. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  120.  
  121. 4662)
  122.  
  123. ERROR/AndroidRuntime(856):     at
  124.  
  125. android.widget.FrameLayout.draw(FrameLayout.java:208)
  126.  
  127. ERROR/AndroidRuntime(856):     at
  128.  
  129. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  130.  
  131. ERROR/AndroidRuntime(856):     at
  132.  
  133. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  134.  
  135. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  136.  
  137. 4550)
  138.  
  139. ERROR/AndroidRuntime(856):     at
  140.  
  141. android.widget.FrameLayout.draw(FrameLayout.java:208)
  142.  
  143. ERROR/AndroidRuntime(856):     at
  144.  
  145. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  146.  
  147. ERROR/AndroidRuntime(856):     at
  148.  
  149. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  150.  
  151. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  152.  
  153. 4550)
  154.  
  155. ERROR/AndroidRuntime(856):     at
  156.  
  157. android.widget.FrameLayout.draw(FrameLayout.java:208)
  158.  
  159. ERROR/AndroidRuntime(856):     at
  160.  
  161. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  162.  
  163. ERROR/AndroidRuntime(856):     at
  164.  
  165. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  166.  
  167. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  168.  
  169. 4550)
  170.  
  171. ERROR/AndroidRuntime(856):     at
  172.  
  173. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  174.  
  175. ERROR/AndroidRuntime(856):     at
  176.  
  177. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  178.  
  179. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  180.  
  181. 4550)
  182.  
  183. ERROR/AndroidRuntime(856):     at
  184.  
  185. android.widget.FrameLayout.draw(FrameLayout.java:208)
  186.  
  187. ERROR/AndroidRuntime(856):     at
  188.  
  189. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  190.  
  191. ERROR/AndroidRuntime(856):     at
  192.  
  193. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  194.  
  195. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  196.  
  197. 4550)
  198.  
  199. ERROR/AndroidRuntime(856):     at
  200.  
  201. android.view.ViewGroup.drawChild(ViewGroup.java:1088)
  202.  
  203. ERROR/AndroidRuntime(856):     at
  204.  
  205. android.view.ViewGroup.dispatchDraw(ViewGroup.java:914)
  206.  
  207. ERROR/AndroidRuntime(856):     at android.view.View.draw(View.java:
  208.  
  209. 4578)
  210.  
  211. ERROR/AndroidRuntime(856):     at
  212.  
  213. android.widget.FrameLayout.draw(FrameLayout.java:208)
  214.  
  215. ERROR/AndroidRuntime(856):     at
  216.  
  217. android.view.ViewRoot.draw(ViewRoot.java:531)
  218.  
  219. ERROR/AndroidRuntime(856):     at
  220.  
  221. android.view.ViewRoot.performTraversals(ViewRoot.java:429)
  222.  
  223. ERROR/AndroidRuntime(856):     at
  224.  
  225. android.view.ViewRoot.handleMessage(ViewRoot.java:584)
  226.  
  227. ERROR/AndroidRuntime(856):     at
  228.  
  229. android.os.Handler.dispatchMessage(Handler.java:80)
  230.  
  231. ERROR/AndroidRuntime(856):     at android.os.Looper.loop(Looper.java:
  232.  
  233. 91)
  234.  
  235. ERROR/AndroidRuntime(856):     at
  236.  
  237. android.app.ActivityThread.main(ActivityThread.java:3052)
  238.  
  239. ERROR/AndroidRuntime(856):     at
  240.  
  241. java.lang.reflect.Method.invokeNative(Native Method)
  242.  
  243. ERROR/AndroidRuntime(856):     at
  244.  
  245. java.lang.reflect.Method.invoke(Method.java:356)
  246.  
  247. ERROR/AndroidRuntime(856):     at android.os.ZygoteInit
  248.  
  249. $MethodAndArgsCaller.run(ZygoteInit.java:1547)
  250.  
  251. ERROR/AndroidRuntime(856):     at
  252.  
  253. android.os.ZygoteInit.main(ZygoteInit.java:1445)
  254.  
  255. ERROR/AndroidRuntime(856):     at
  256.  
  257. android.dalvik.NativeStart.main(Native Method)
Parsed in 0.051 seconds, using GeSHi 1.0.8.4


do i use too much layout-components? Why does the stack overflow? i
don't use any recursion. is this a bug?
Please halp! thanx a lot.
bAZtARd
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 09, 2008 11:03 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests