Monday, 25 June 2012

Programmatically add Image to Gallery


private void addPicToGallery() {
    Intent media = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);


//mCurrentPhotoPath is the path to image.
    File f = new File(mCurrentPhotoPath);
    Uri contentUri = Uri.fromFile(f);
    media.setData(contentUri);
    this.sendBroadcast(media);
}
profile for Vineet Shukla at Stack Overflow, Q&A for professional and enthusiast programmers

2 comments: