Project

General

Profile

« Previous | Next » 

Revision 88d9ff62

Added by Leszek Koltunski almost 8 years ago

Save the image to 'Pictures' album in the Gallery.

View differences:

src/main/java/org/distorted/examples/save/SaveWorkerThread.java
20 20
package org.distorted.examples.save;
21 21

  
22 22
import android.app.Activity;
23
import android.content.Intent;
23 24
import android.graphics.Bitmap;
25
import android.net.Uri;
24 26
import android.widget.Toast;
25 27

  
26 28
import java.io.BufferedOutputStream;
29
import java.io.File;
27 30
import java.io.FileOutputStream;
28 31
import java.io.IOException;
29 32
import java.lang.ref.WeakReference;
......
189 192
        catch(IOException io) {}
190 193
        }
191 194
      }
195

  
196
    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
197
    File f = new File(filename);
198
    Uri contentUri = Uri.fromFile(f);
199
    mediaScanIntent.setData(contentUri);
200
    act.sendBroadcast(mediaScanIntent);
192 201
    }
193 202
  }

Also available in: Unified diff