image - take picture from android camera and send it to web server -
im build apps call camera activity..
im take picture apps , send web server..
but can't image path..
im getting nullexception error when try image path..
here's code when calling camera activity :
intent camera = new intent(mediastore.action_image_capture); this.startactivityforresult(camera, picture_result);
and code activity result :
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == picture_result){ if (resultcode == activity.result_ok) { takepicture(data); } else if (resultcode == activity.result_canceled) { } } } protected void takepicture(intent data) { bundle b = data.getextras(); pic = (bitmap) b.get("data"); if (pic != null) { imagepicture.setimagebitmap(pic); } }
is there wrong code?
thanks
ok, see problem. you're not setting path begin with. please @ doc.
http://developer.android.com/reference/android/provider/mediastore.html#action_image_capture
so see, when call action_image_capture not passing extra_output
tells application picture going stored. extra_output path file.
so right under make intent this:
intent camera = new intent(mediastore.action_image_capture); uri pictureuri = uri.fromfile(new file(<path file>)); camera.putextra(mediastore.extra_output, pictureuri);
Comments
Post a Comment