android - geting extra in activityForResult -
i have been googleling far no luck. have app in wich start activityforresult , in put string extra.
edit couldn't post complex code since on table, got on laptop here code
the activityforresult:
@override protected void oncreate(bundle saved) { super.oncreate(saved); setcontentview(r.layout.camera); = new aquery(this); output = getintent().getextras().getstring("output");//here, nothing passed!!!!!!!! //log.d("out",output); /** check if device has camera */ if (this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_any)){ text ="yes"; //now check cam features if(this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_front)) front ="yes"; if(this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_flash)) flash = "yes"; if(this.getpackagemanager().hassystemfeature(packagemanager.feature_camera)) back= "yes"; }else{ text = "this device not have camera"; //---set data pass back--- data.putextra("vid",text); setresult(result_ok, data); //---close activity--- finish(); } if (c != null) { c.release(); c = null; } m = new mediarecorder(); c = getcamerainstance(this); camera.parameters parameters = c.getparameters(); // create our preview view , set content of our activity. mpreview = new camerapreview(this, c); int orien =getresources().getconfiguration().orientation; if(orien ==1){ parameters.setrotation(0); // set rotation save picture c.setdisplayorientation(90); parameters.setpicturesize(640, 480); pic_orientation = "landscape"; }else{ parameters.setrotation(0); // set rotation save picture c.setdisplayorientation(0); parameters.setpicturesize(640, 480); pic_orientation = "portrait"; } if (camera.getnumberofcameras() < 2) { //todo } fileuri = getoutputmediafileuri(); c.setparameters(parameters); m.setcamera(c); framelayout preview = (framelayout) findviewbyid(r.id.camera_preview); preview.addview(mpreview); }
and launching intent
cam.setonclicklistener(new onclicklistener(){ @override public void onclick(view v) { intent = new intent(mess.this,cam.class); i.putextra("output", vids); startactivityforresult(i,2); dialog.cancel();//todo } });
nothing passed in value.. null... activityforresult... in activity, passed value.
you put value:
i.putextra("string","value");
then value:
string value = getintent().getextras().getstring("value");
the second line should be
string value = getintent().getextras().getstring("string");
Comments
Post a Comment