android - java.lang.ArithmeticException: divide by zero in clearing table -
i trying clear table following code :
int count = table_layout_acc_statement.getchildcount(); (int = 0; < count; i++) { view child = table_layout_acc_statement.getchildat(i); if (child instanceof tablerow) ((viewgroup) child).removeallviews();
but getting following exception :
05-09 15:53:07.526: e/androidruntime(14072): fatal exception: main 05-09 15:53:07.526: e/androidruntime(14072): process: com.era.customeragentapp, pid: 14072 05-09 15:53:07.526: e/androidruntime(14072): java.lang.arithmeticexception: divide 0 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.tablelayout.mutatecolumnswidth(tablelayout.java:587) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.tablelayout.shrinkandstretchcolumns(tablelayout.java:576) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.tablelayout.measurevertical(tablelayout.java:474) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.tablelayout.onmeasure(tablelayout.java:439) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.horizontalscrollview.onmeasure(horizontalscrollview.java:329) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5374) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1621) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.linearlayout.measurevertical(linearlayout.java:742) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.linearlayout.onmeasure(linearlayout.java:607) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5374) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.framelayout.onmeasure(framelayout.java:340) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5374) 05-09 15:53:07.526: e/androidruntime(14072): @ com.android.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:327) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5374) 05-09 15:53:07.526: e/androidruntime(14072): @ android.widget.framelayout.onmeasure(framelayout.java:340) 05-09 15:53:07.526: e/androidruntime(14072): @ com.android.internal.policy.impl.phonewindow$decorview.onmeasure(phonewindow.java:2368) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.view.measure(view.java:16848) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewrootimpl.performmeasure(viewrootimpl.java:2246) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewrootimpl.measurehierarchy(viewrootimpl.java:1312) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewrootimpl.performtraversals(viewrootimpl.java:1509) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewrootimpl.dotraversal(viewrootimpl.java:1189) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:6223) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.choreographer$callbackrecord.run(choreographer.java:788) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.choreographer.docallbacks(choreographer.java:591) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.choreographer.doframe(choreographer.java:560) 05-09 15:53:07.526: e/androidruntime(14072): @ android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:774) 05-09 15:53:07.526: e/androidruntime(14072): @ android.os.handler.handlecallback(handler.java:808) 05-09 15:53:07.526: e/androidruntime(14072): @ android.os.handler.dispatchmessage(handler.java:103) 05-09 15:53:07.526: e/androidruntime(14072): @ android.os.looper.loop(looper.java:193) 05-09 15:53:07.526: e/androidruntime(14072): @ android.app.activitythread.main(activitythread.java:5330) 05-09 15:53:07.526: e/androidruntime(14072): @ java.lang.reflect.method.invokenative(native method) 05-09 15:53:07.526: e/androidruntime(14072): @ java.lang.reflect.method.invoke(method.java:515) 05-09 15:53:07.526: e/androidruntime(14072): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:828) 05-09 15:53:07.526: e/androidruntime(14072): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:644) 05-09 15:53:07.526: e/androidruntime(14072): @ dalvik.system.nativestart.main(native method) 05-09 15:53:09.402: e/(14376): appname=com.era.customeragentapp, acappname=/system/bin/surfaceflinger 05-09 15:53:09.402: e/(14376): 0 05-09 15:53:09.402: e/(14376): appname=com.era.customeragentapp, acappname=/system/bin/surfaceflinger 05-09 15:53:09.402: e/(14376): 0
why getting error ? how can solve error ?
jsut call table.removeallviews();
tablelayout table = (tablelayout) findviewbyid(r.id.mytable); table.removeallviews();
Comments
Post a Comment