android widget - Get Path form camera intent ACTION_IMAGE_CAPTURE -
hi using camera intent following...
intent cameraintent = new intent(mediastore.action_image_capture); cameraintent.putextra(mediastore.extra_output, (new file(environment.getexternalstoragedirectory(),string.valueof(system.currenttimemillis()) + ".jpg"))); startactivityforresult(cameraintent, 0);
now don't know how image path clicked camera in onactivityresult()
method please if 1 know me...
my solution:
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (resultcode == result_canceled) { toast toast = toast.maketext(this,"camera cancelled", 10000); toast.show(); return; } if ((requestcode == customerrequestactivity.take_image) && (resultcode == result_ok)) { // mode = mode_viewer; string[] projection = { mediastore.images.media.data }; cursor cursor = managedquery(mcapturedimageuri, projection, null,null, null); int column_index_data = cursor .getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); //this want! string capturedimagefilepath = cursor.getstring(column_index_data); bitmap bm; log.v("/////////////", "///////"); log.v("\n\n\n\n", capturedimagefilepath); log.v("///////////", "///////////"); bm = bitmapfactory.decodefile(capturedimagefilepath); capturedimageview.setimagebitmap(bm); } }
Comments
Post a Comment