samples/Support4Demos/src/main/java/com/example/android/supportv4/content/FileProviderExample.java
private void saveThumbnail(View view, File file) {
        final Bitmap bitmap = Bitmap.createBitmap(
                view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        view.draw(canvas);

        try {
            final OutputStream os = new FileOutputStream(file);
            try {
                bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
            } finally {
                os.close();
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
/**
     * Save thumbnail of given {@link View} to {@link File}.
     */
Save thumbnail of given  View to  File.
Save thumbnail of given View to File .
private void saveThumbnail(View view, File file) {
        final Bitmap bitmap = Bitmap.createBitmap(
                view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        view.draw(canvas);
        try {
            final OutputStream os = new FileOutputStream(file);
            try {
                bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
            } finally {
                os.close();
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
private void saveThumbnail ( View view , File file ) { final Bitmap bitmap = Bitmap . createBitmap ( view . getWidth ( ) , view . getHeight ( ) , Bitmap . Config . ARGB_8888 ) ; final Canvas canvas = new Canvas ( bitmap ) ; view . draw ( canvas ) ; try { final OutputStream os = new FileOutputStream ( file ) ; try { bitmap . compress ( Bitmap . CompressFormat . PNG , 100 , os ) ; } finally { os . close ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Save thumbnail of given {@link View} to {@link File}.
Save thumbnail of given { @link View } to { @link File } .