Revision: 13010
Updated Code
at April 11, 2009 21:41 by abwaters
Updated Code
Uri saveMediaEntry(String imagePath,String title,String description,long dateTaken,int orientation,Location loc) { 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); File f = new File(imagePath) ; File parent = f.getParentFile() ; String path = parent.toString().toLowerCase() ; String name = parent.getName().toLowerCase() ; 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); }
Revision: 13009
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 4, 2009 16:09 by abwaters
Initial Code
Uri saveMediaEntry(String name,String desc,long dateTaken,int orientation,Location loc,String path) { ContentValues v = new ContentValues(); v.put(Images.Media.TITLE, name); v.put(Images.Media.DISPLAY_NAME, name); v.put(Images.Media.DESCRIPTION, desc); v.put(Images.Media.DATE_TAKEN, dateTaken); v.put(Images.Media.MIME_TYPE, "image/jpeg"); v.put(Images.Media.ORIENTATION, orientation); if( loc != null ) { v.put(Images.Media.LATITUDE, loc.getLatitude()); v.put(Images.Media.LONGITUDE, loc.getLongitude()); } v.put("_data",path) ; ContentResolver c = getContentResolver() ; return c.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, v); }
Initial URL
Initial Description
Save an image to the media library on android
Initial Title
Save Image to Media Provider on Android
Initial Tags
image, android
Initial Language
Java