android - What is the meaning of this method? -


this code:

public class photo extends activity implements view.onclicklistener {  imageview iv; button bt; imagebutton ib; intent ; bitmap bmp; final static int cameradata =0; @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     intsallttion();  } private void intsallttion() {     // todo auto-generated method stub     iv = (imageview) findviewbyid(r.id.iv);     bt = (button) findviewbyid(r.id.bt);     ib = (imagebutton) findviewbyid(r.id.ib);      bt.setonclicklistener(this);     ib.setonclicklistener(this); }  @override public void onclick(view v) {     switch(v.getid()){     case r.id.bt:          break;      case r.id.ib:         = new intent(android.provider.mediastore.action_image_capture);         startactivityforresult(i,cameradata);         break;     } }  @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     // todo auto-generated method stub     super.onactivityresult(requestcode, resultcode, data);     if(resultcode==result_ok){         bundle extras = data.getextras();         bmp = (bitmap) extras.get("data");         iv.setimagebitmap(bmp);     } } } 

i didn't understand method:

    @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     // todo auto-generated method stub     super.onactivityresult(requestcode, resultcode, data);     if(resultcode==result_ok){         bundle extras = data.getextras();         bmp = (bitmap) extras.get("data");         iv.setimagebitmap(bmp);     } } 

what method do?

you opened activity of camera startactivityforresult , libin said , getting result there; result picture. tried add coments:

     @override      protected void onactivityresult(int requestcode, int resultcode, intent data) {      // todo auto-generated method stub       super.onactivityresult(requestcode, resultcode, data);       // check result code got activity of camera       // if user took picture result_ok else result_canceled       if(resultcode==result_ok){            // picture communicated activity of camera activity             // intent extras bundle : put bundle in bundle            bundle extras = data.getextras();            // take bitmap (your picture in format bitmap)form extras             bmp = (bitmap) extras.get("data");            // showing bitmap in imageview iv            iv.setimagebitmap(bmp);     } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -