ContentValues v = new ContentValues();
v.put(Images.Media.TITLE, title);
v.put(Images.Media.DISPLAY_NAME, displayName);
v.put(Images.Media.DESCRIPTION, description);
v.put(Images.Media.DATE_ADDED, dateTaken);
v.put(Images.Media.DATE_TAKEN, dateTaken);
v.put(Images.Media.DATE_MODIFIED, dateTaken) ;
v.put(Images.Media.MIME_TYPE, "image/jpeg");
v.put(Images.Media.ORIENTATION, orientation);
v.put(Images.ImageColumns.BUCKET_ID, path.hashCode());
v.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, name);
v.put(Images.Media.SIZE,f.length()) ;
f = null ;
if( targ_loc != null ) {
v.put(Images.Media.LATITUDE, loc.getLatitude());
v.put(Images.Media.LONGITUDE, loc.getLongitude());
}
v.put("_data",imagePath) ;
ContentResolver c = getContentResolver() ;
return c.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, v);
}
Save Image to Media Provider on Android - Java - Snipplr.
displayName is used on line 4, but isn't in scope, at least within this code fragment.
ReplyDeletevery nice... thank you very much. it went straight to my head. :)
ReplyDeletewhere to add this code ?
ReplyDelete