Activity of my android project is skipping -


i have created simple android project. but, problem 2nd activity among 3 of it's activities skipping. logcat displays few warnings.

"skipped 108 frames! application may doing work on main thread." 

my 2nd activity-

edittext et1,et2,et3,et4; button btn; int i,counter; double theory_credit,theory_gp,lab_credit,lab_gp,total_credit,total_gp,cgpa;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_another);      et1 = (edittext) findviewbyid(r.id.edittext1);     et2 = (edittext) findviewbyid(r.id.edittext2);     et3 = (edittext) findviewbyid(r.id.edittext3);     et4 = (edittext) findviewbyid(r.id.edittext4);     btn = (button) findviewbyid(r.id.button1);      string value=getintent().getstringextra("input");     counter=integer.parseint(value);     theory_credit=theory_gp=lab_credit=lab_gp=total_credit=total_gp=cgpa=0.0;      for(i=1;i<=counter;i++){           btn.setonclicklistener(new onclicklistener() {              @override             public void onclick(view v) {                  string inp;                  inp=et1.gettext().tostring();                 theory_credit=double.parsedouble(inp);                 et1.settext("");                 inp=et2.gettext().tostring();                 theory_gp=double.parsedouble(inp);                 et2.settext("");                 inp=et3.gettext().tostring();                 lab_credit=double.parsedouble(inp);                 et3.settext("");                 inp=et4.gettext().tostring();                 lab_gp=double.parsedouble(inp);                 et4.settext("");                  if(theory_gp>0.0 && theory_credit>0.0){                     total_credit+=theory_credit;                     total_gp+=(theory_gp*theory_credit);                 }                  if(lab_gp>0.0 && lab_credit>0.0){                     total_credit+=lab_credit;                     total_gp+=(lab_gp*lab_credit);                 }             }         });     }      if(total_credit>0.0){         cgpa=total_gp/total_credit;     }      intent intent=new intent(anotheractivity.this, finalactivity.class);     intent.putextra("result", cgpa);     startactivity(intent); } 

how can fix ? 1st , 3rd activities working well.

there no need add 2 layouts in single java class. each layout associated single class. hence, in code have written setcontentview(r.id.yourlayout) twice, not needed. , moreover, in single ui thread cannot put 2 layouts, may 1 reason crash.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -