Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.*;

public class Main {
    public static Bitmap loadResource(Context context, int resourceId) {

        Resources resources = context.getResources();

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inDensity = resources.getDisplayMetrics().densityDpi;
        options.inPurgeable = true;

        return BitmapFactory.decodeResource(resources, resourceId, options);
    }
}