How to get latitude and longiture from captured image -- android -
i new android development. writing code retrieve lat , long image capture.i can able take image using camera event , onactivityresult.
eprotected void onactivityresult(int requestcode, int resultcode, intent data) { uri _uri = null; cursor cursor = null; try { final int pick_image = 1; if (requestcode == pick_image && data != null && data.getdata() != null) { _uri = data.getdata(); if (_uri != null) { // user had pick image. cursor = getcontentresolver() .query(_uri, new string[] { android.provider.mediastore.images.imagecolumns.data }, null, null, null); cursor.movetofirst(); // link image final string imagefilepath = cursor.getstring(0); // toast.maketext(getapplicationcontext(), imagefilepath, // toast.length_long).show(); imagelocation= imagefilepath; file imgfile = new file(imagefilepath); if (imgfile.exists()) { bitmap mybitmap = bitmapfactory.decodefile(imgfile.getabsolutepath()); captureimage.setimagebitmap(mybitmap); } cursor.close(); } else { // toast.maketext(getapplicationcontext(), getsdcard, // toast.length_long).show(); } } super.onactivityresult(requestcode, resultcode, data); } catch (exception e) { if (cursor == null || cursor.equals("")) { string getsdcard = _uri.getpath(); imagelocation= getsdcard; file imgfile = new file(getsdcard); if (imgfile.exists()) { bitmap mybitmap = bitmapfactory.decodefile(imgfile.getabsolutepath()); captureimage.setimagebitmap(mybitmap); } } e.printstacktrace(); } }
from how come latitude , longitude image. searched while, cant able location.
what monkeyless suggested right, use exifinterface. there working example in accepted answer here:
Comments
Post a Comment