Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import java.io.InputStream;

public class Main {
    public static Bitmap generateBitmap(Context context, int resId, BitmapFactory.Options options) {

        options.inPreferredConfig = Bitmap.Config.RGB_565;
        options.inPurgeable = true;
        options.inInputShareable = true;

        InputStream is = context.getResources().openRawResource(resId);

        return BitmapFactory.decodeStream(is, null, options);
    }
}