Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import android.net.Uri;

public class Main {
    /**
     * Get bitmap from internal image file.
     */
    public static Bitmap getBitmapFromUri(Uri fileUri) {
        // bitmap factory
        BitmapFactory.Options options = new BitmapFactory.Options();

        // downsizing photoImage as it throws OutOfMemory Exception for larger
        // images
        options.inSampleSize = 8;
        options.inMutable = true;

        return BitmapFactory.decodeFile(fileUri.getPath(), options);
    }
}