Android: (simple) missing import or...? -


i following book learn android , getting error, codecode error

i using image above can see error (compoundbutton).

did type wrong or did book not write of imports needed?

thanks!

edited full code:

package newbook.appress;  import android.app.activity; import android.os.bundle; import android.widget.checkbox; import android.widget.compoundbutton;  public class checkboxdemo extends activity  implements compoundbutton.oncheckchangedlistener{      checkbox cb;       @override        public void oncreate(bundle icicle) {          super.oncreate(icicle);          setcontentview(r.layout.main);           cb=(checkbox)findviewbyid(r.id.chkbox1);         cb.setoncheckedchangelistener(this);      }        public void oncheckedchanged(compoundbutton buttonview,               boolean ischecked) {          if (ischecked) {          cb.settext("this checkbox is: checked");          }          else {          cb.settext("this checkbox is: unchecked");          }          }  } 

that correct. need import everything. missing:

    import android.widget.compoundbutton 

you can type:

ctrlshift+o o rganize imports automatically in eclipse.

you'll want change second error to:

cb.setoncheckedchangelistener(this); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -