Using java Syntax Highlighting
- // Add some parameters to the image that will be stored in the Image ContentProvider
- int UNIQUE_BUCKET_ID = 1337;
- ContentValues values = new ContentValues(7);
- values.put(MediaStore.Images.Media.DISPLAY_NAME,"name of the picture");
- values.put(MediaStore.Images.Media.TITLE,"Thats the title of the image");
- values.put(MediaStore.Images.Media.DESCRIPTION, "Some description");
- values.put(MediaStore.Images.Media.BUCKET_DISPLAY_NAME,"Album name");
- values.put(MediaStore.Images.Media.BUCKET_ID,UNIQUE_BUCKET_ID);
- values.put(MediaStore.Images.Media.DATE_TAKEN,System.currentTimeMillis());
- values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
- // Inserting the image meta data inside the content provider
- Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
- // Filling the real data returned by the picture callback function into the content provider
- try {
- OutputStream outStream = getContentResolver().openOutputStream(uri);
- outStream.write(buffer); // buffer is the data stream returned by the picture callback
- outStream.close();
- }catch (Exception e) {
- Log.e(TAG, "Exception while writing image", e);
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
SDK Version compatible: 0.9, 1.0



