java - Android: MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA -
can ony give me guidelines on how find directory android device stores images takem camera;
in following code snippet, intend list of files in prior launching camera app. when returning camera app list of files in same directory , process newly added ones.
public void onbtntakephoto(final view view) { existingfiles = uploadimageservice.getfiles(<image_location>); final intent intent = new intent(mediastore.intent_action_still_image_camera); startactivityforresult(intent, take_picture); } public void onactivityresult(final int requestcode, final int resultcode, final intent data) { super.onactivityresult(requestcode, resultcode, data); switch (requestcode) { case take_picture: list<string> newfies = uploadimageservice.getfiles(<image_location>); newfies.removeall(existingfiles); (string newfile : newfies) { file file = new file(newfile); addimage( uri.fromfile(file), picturesource.camera); } break; } // regardless of activity, check files exist: verifyfilesexist(images); }
as far understand it, have launch intent action_image_capture
action (instead of intent_action_still_image_camera). then, in onactivityresult
have data intent: there find reference image.
look @ examples given here.
but @ answer, find more useful:
string[] projection = { mediastore.images.imagecolumns._id, mediastore.images.imagecolumns.data }; string selection = ""; string[] selectionargs = null; mimageexternalcursor = managedquery(mediastore.images.media.external_content_uri, projection, selection, selectionargs, null); mimageinternalcursor = managedquery(mediastore.images.media.internal_content_uri, projection, selection, selectionargs, null);
then
string filepath = mimageexternalcursor.getstring(mimageexternalcursor.getcolumnindexorthrow( mediastore.images.imagecolumns.data));
(since don't want take new picture).
Comments
Post a Comment